Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Strange Cookie Problem with Firefox
Old 09-15-2006, 06:48 AM Strange Cookie Problem with Firefox
Novice Talker

Posts: 9
Name: Rhys Wynne
Trades: 0
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.
rhyswynne is offline
Reply With Quote
View Public Profile Visit rhyswynne's homepage!
 
 
Register now for full access!
Old 09-15-2006, 11:53 AM Re: Strange Cookie Problem with Firefox
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Well the "End -->" could be screwing things up, as "End" doesn't need to be there. It would generate an error.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 09-15-2006, 11:59 AM Re: Strange Cookie Problem with Firefox
Novice Talker

Posts: 9
Name: Rhys Wynne
Trades: 0
Doh! Thank you so much!
rhyswynne is offline
Reply With Quote
View Public Profile Visit rhyswynne's homepage!
 
Reply     « Reply to Strange Cookie Problem with Firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12393 seconds with 12 queries