Page Depending On Browser

Script by: Iceman

     This is a script that chooses pages from the browser for your reader. Rather than creating a ton of pages, I thought I'd just give you the letter that came to me. It has the script.


Hi! I saw the HTML goodies page. Ok, I have a script that checks the type of browser you have and then sends it to the correct page... In other words, you begin to load the page where the script resides and it then, depending on your browser, redirects you to the correct page, if required, for that browser. Hereīs the HTML Page code with the script, plus the other one required in the script, one for Netscape, and there is a note at the bottom of how to make the page for MSIE. The first one is for non-JScript Browsers:


Browser Checking Script: Netscape Page
<SCRIPT LANGUAGE = "JavaScript">
<!--
// Script by Iceman, dciceman@usa.net. You can use this script providing
this header stays in. Copyright 1997 Iceman.

var browser = navigator.appName

if (browser == "Microsoft Internet Explorer" && navigator.appVersion=="4.0
(compatible; MSIE 4.0b1; Windows 95)") { 
//If Browser is MSIE 4.0 then go to MSIE Page.		
parent.location.href="msiepag.htm"
var r=2}

else {
if (navigator.UserAgent=="Mozilla/2.0 (compatible; MSIE 3.02; Windows 95)")
{
//If Browser is MSIE 3.02 go to MSIE Page.
parent.location.href="msiepag.htm"
var r=2}

if (navigator.appVersion=="2.01 (Win95; I)" &&
navigator.appCodeName=="Mozilla") { 
//If Browser is Netscape 2.01 go to Netscape page.
parent.location.href="nspag.htm"
var r=1}

if (browser == "Netscape" && navigator.appVersion=="3.0 (Win95; I)") { 
// If browser is Netscape 3.0 go to Netscape Page.
parent.location.href="nspag.htm"
var r=1}
      }

if (browser=="Netscape") {
// If browser is Netscape and Supports JavaScript go to Netscape Page
parent.location.href="nspag.htm"
var r=1}

if (r !=1 && r !=2){      
// if browser is not Nestcape or MSIE known versions go to MSIE page.
(caters for any other JavaScript Browsers).
parent.location.href="msie.pag" }
    
// -->

</SCRIPT>


  
Sorry, you have a non-JavaScript compatible Browser, you canīt use this script.
Author:Iceman: dciceman@usa.net
Back to HTML Goodies ----HERE DOWN: NETSCAPE PAGE!!---- Netscape Page Hi! You have a Netscape Browser that is JavaScript capable! Author:Iceman: dciceman@usa.net
Hereīs the Script:
<SCRIPT LANGUAGE = "JavaScript"> <!-- // Script by Iceman, dciceman@usa.net. You can use this script providing this header stays in. Copyright 1997 Iceman. var browser = navigator.appName if (browser == "Microsoft Internet Explorer" && navigator.appVersion=="4.0 (compatible; MSIE 4.0b1; Windows 95)") { //If Browser is MSIE 4.0 then go to MSIE Page. parent.location.href="msiepag.htm" var r=2} else { if (navigator.UserAgent=="Mozilla/2.0 (compatible; MSIE 3.02; Windows 95)") { //If Browser is MSIE 3.02 go to MSIE Page. parent.location.href="msiepag.htm" var r=2} if (navigator.appVersion=="2.01 (Win95; I)" && navigator.appCodeName=="Mozilla") { //If Browser is Netscape 2.01 go to Netscape page. parent.location.href="nspag.htm" var r=1} if (browser == "Netscape" && navigator.appVersion=="3.0 (Win95; I)") { // If browser is Netscape 3.0 go to Netscape Page. parent.location.href="nspag.htm" var r=1} } if (browser=="Netscape") { // If browser is Netscape and Supports JavaScript go to Netscape Page parent.location.href="nspag.htm" var r=1} if (r !=1 && r !=2){ // if browser is not Nestcape or MSIE known versions go to MSIE page. (caters for any other JavaScript Browsers). parent.location.href="msie.pag" } // --> </SCRIPT> Back to HTML Goodies ------END OF CODE-----
Could you name the Netscape page nspag.htm and then change the title and text to MSIE and then call the resulting page msiepag.htm? That should do it!

Thanks,
David

Back to the HTML and Developer Scripts