...

Create cookie with javascript - Safari issue

valanto
08-21-2007, 03:19 PM
In my website I create a typical cookie, after the page has finished loading, using a javascript script using the standard way of setting cookies as found in the w3schools tutorial (http://www.w3schools.com/js/js_cookies.asp):

function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}


My script works an all browsers i've tested it on (firefox, internet explorer, opera) EXCEPT Safari!

Does anyone know how to overcome this? Any suggestions are welcome!

Thank you,
Valanto

valanto
08-21-2007, 03:48 PM
Problem resolved
It needs for the cookies preference to be "always" since my page sets the cookie after it finishes loading and not before it loads. Also safari doesn't like cookies coming from localhost. When I tested it on another server and with cookies always enabled it worked fine!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum