I'm designing a website that, by law, needs a confirmation method before opening. I'm using javascript because it doesn't harm the site's search engine ranking. It's very simple code that will display the confirmation box once, and then never again that session, should the user accept. The code works in IE but not in Firefox. Below is the code.
HTML Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function checkCount() {
if ( !document.cookie.length )
{
input_box=confirm("Click OK or Cancel to Continue");
if (input_box==true)
{
// Output when OK is clicked
document.cookie = 'popup=no';
}
else
{
// Output when Cancel is clicked
window.location = "http://www.google.co.uk";
}
}
}
End -->
</script>
</head>
<BODY OnLoad="checkCount()">
<p>Page!<p>
</body></html>
The problem lies within the cookie, as the alertbox works fine within firefox. I suspect it's within the !document.cookie.length, and the way Firefox handles session cookies. I could be wrong though. Is this a known issue with firefox, if so, is there a way around it?
Thanks for any assistance I recieve.
|