Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sticking cookies in Safari

    I am reading/writing cookies to control which default page the user will land on. Works fine in FireFox, but on Safari, the cookie tends to stick and will not change. Here is my code:


    Code:
    // this function reads the pulldown menu's selected item, tells the cookie writing function which index number it is, then goes to that page.
    
    function myJumpMenu(oSrc)
    	{
    		url = oSrc.options[oSrc.selectedIndex].value;
    		selectorIndex = oSrc.selectedIndex;
    		//alert(selectorIndex);
    		write_cookie(selectorIndex);
    		goNow();
    	}
    	
    
    //sets the default on the pulldown menu
    function setDefault() {
          document.forms[0].elements[0].selectedIndex=selectorIndex;	
    }
    
    
    // Writes the cookie
    // I get the right number on the first alert, but it doesn't change the cookie
    //second alert gives me the old cookie value 
    //so if I chose "1" I'd get an alert of "1", but document.cookie alert says "language=5"
    
    function write_cookie(lang) {
    	alert(lang);
    	document.cookie = "language=" + lang + "; expires=Wednesday, 01-Aug-2020 08:00:00 GMT";
    	alert(document.cookie);
    }

  • #2
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Some more info: The page with the pulldown menu that sets the cookie is in one of 2 frames. If I load that frame on its own, it will change the cookie just fine in Safari, but when it's part of the 2 frames, it doesn't change it. Has anyone run into this problem before???
    Last edited by pbesong; 12-10-2009 at 03:53 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •