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: Intermediate
Apr 22, 1999

Send Visitors to the Front Page

Many Web site managers prefer all site visitors to enter their site through the front page. The front page may contain site usage information that all users should see, or navigation tools that they'll be lost without. In any case, you can ensure that all visitors go to the front page first by checking the referring page with JavaScript and redirecting if necessary. If the referring URL doesn't contain your site's domain name, chances are it came from an outside link. This JavaScript function checks the referring URL for the domain name "razorfish", and if it doesn't find it sends the user to the front page of the Razorfish site.
 
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
     function redirect() {
          if (document.referrer.indexOf("razorfish") == -1) {
                  window.location = "http://www.razorfish.com";
          }
     }
</SCRIPT>
</HEAD>

<BODY onload="redirect()";>

...

</BODY>
</HTML>
Steve Renaker
 
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