Help and Support
 

powered byLive Search

FP2000: FP2000: Sample JavaScript Code to Redirect Page Based on Browser

Article ID:208649
Last Review:July 4, 2007
Revision:2.1
This article was previously published under Q208649

For a Microsoft FrontPage 98 version of this article, see 193057 (http://support.microsoft.com/kb/193057/EN-US/).

SUMMARY

This article provides sample JavaScript that redirects a Web browser to a specific page based on which browser you are using.

Back to the top

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. NOTE: The following JavaScript has been tested in Microsoft Internet Explorer versions 3.0, 4.0, 5.0 and Netscape Navigator versions 3.0, 4.0, and 4.5.

To redirect the browser using a script, follow these steps:
1.Start FrontPage and open the HTML page you want to edit.
2.On the Tools menu, point to Macro, and then click Microsoft Script Editor.
3.In the Language section, click JavaScript.
4.In the Script box, type the following script:
      var version = navigator.appVersion;

      // sets variable = browser version
      if (version.indexOf("MSIE") >= -1)
      // checks to see if using IE
         {
         window.location.href="ie.htm"
         /* If using IE, it shows this page
         replace ie.htm with page name */ 
      }else
      window.open("other.htm", target="_self")
      /* else open other page
      replace other.html with page name */ 
						
5.Click OK.
6.On the File menu, click Save.
7.Open the page in a Web browser that supports client-side scripting.

Back to the top

REFERENCES


For more information about Microsoft JScript, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/hbxc2t98(VS.71).aspx (http://msdn2.microsoft.com/en-us/library/hbxc2t98(VS.71).aspx)

Back to the top


APPLIES TO
Microsoft FrontPage 2000 Standard Edition

Back to the top

Keywords: 
kbcode kbhtml kbinfo kbusage KB208649

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.