Cookie Trouble

wxdqz

New Member
Could somebody test the following script for me? I have a script (written by hfraser) setup as an include file to detect a netscape browser 4x and lower. In order to avoid a visistor from seeing the popup window on every page of the site (i have the include file on every page of my site), I would like to have a cookie in place; however the cookie function in the script doesn't seem to work.

Any help would be MUCH appreciated.

<script language="JavaScript" type="text/JavaScript">
function setCookieNav(){
var cookieDies = new Date();
// i set the cookie to expire in a week
cookieDies.setTime(cookieDies.getTime() + 7*24*60*60*1000);
// set the content of the cookie
document.cookie = "visit=true.;expires=" + cookieDies.toGMTString();
}

function getCookieNav(){
var MyCookie = new String(document.cookie);
var myCookieHeader = "visit=";
var MyCookieStart = MyCookie.indexOf(myCookieHeader);

// extract data
// if the cookie does not exist well set one and build your window!
if( MyCookieStart = -1){
setCookieNav();
buildNavInfo();
};
}

function buildNavInfo(){
var br = navigator.appName ;
var brv = navigator.appVersion ;
if(br == "Netscape")
{
if(brv<"5.0")
{
newwindow=window.open("","new1","width=500,height=175");

newwindow.document.write("<font face='arial, helvetica, ms sans serif' size='2'><b>Please note:</b><br><br>Our site is best viewed using Netscape 5.0 or higher browsers. It appears you are using Netscape "+brv+". Please visit <a href='http://www.netscape.com' onClick='window.opener.location=this.href;window.close(); return false'>Netscape</a> for a free copy of a newer version of Netscape.<br><br>If you believe this message is the result of a system error, please contact our <a href='http://www.webdeveloper.com/forum/archive/index.php/mailto:[email protected]'>webmaster</a>.<p align='right'><a href='http://www.webdeveloper.com/forum/archive/index.php/javascript:window.close()'>close window</a></p></font>");

newwindow.document.close();
}
}
}
</script>

The following is on every htm page:

<body onLoad="getCookieNav();">
 
Back
Top