...

View Full Version : Sticking cookies in Safari



pbesong
12-09-2009, 10:56 PM
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:




// 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);
}

pbesong
12-09-2009, 11:39 PM
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???



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum