Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: All
Jul 2, 1999

Make Web Visitors Use the Front Door

When you design a Web page using frames, you expect visitors to start at the address of the frameset holder, for example, default.htm. However, people who are linking from a search engine may end up bypassing the frameset. The link points directly to a page that was never meant to stand alone. You can gently nudge visitors to the "front door" by using a little JavaScript at the very start of each page that sits inside the frameset. In this example, left.htm, the script checks to see if the current page is the top of the frameset. If it is, the script redirects the browser to the container page, default.htm.

 
<SCRIPT LANGUAGE="JavaScript">
currlocation=location.href;
if (parent.location.href == currlocation)
{
parent.location.replace("default.htm");
}
</SCRIPT>
<HTML>
<BODY>
<P>Left page</P>
<A href="anotherleft.htm">Click here</A>
</BODY>
</HTML>

Don't put the script in your frameset page or you'll create an endless loop in which the only way out is to close the browser.

Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date