Redirecting a Browser


You also can use the location object to redirect a browser as soon as a page loadsfor example, to a page with browser-specific code. We saw how to do that in Chapter 4 as wellthis is Listing 04-09.html on the web site (note that this code also redirects browsers that don't support scripting using a <META> element):

 <HTML>      <HEAD>          <TITLE>Redirecting Browsers</TITLE>          <SCRIPT LANGUAGE="JavaScript">              <!--  if (navigator.appName == "Microsoft Internet Explorer") {   window.location.href="IE.html"   }   if(navigator.appName == "Netscape") {   window.location.href="NS.html"   }  //-->          </SCRIPT>          <META HTTP-EQUIV="refresh" CONTENT="0; URL=default.html">      </HEAD>      <BODY>          <H1>Redirecting Browsers</H1>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net