[TYPO3-english] Re: realurl and javascript cookie usage

Chanh Pham chanhpm at gmail.com
Mon Feb 17 05:10:45 CET 2014


I got the same issue. Here's my function of writing cookie

writeCookie: function(key, value, exdays){
		var exdate = new Date();
		var mydomain = "." + document.location.hostname.replace("www","");
		exdate.setDate(exdate.getDate() + exdays);
		var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
		document.cookie=key + "=" + c_value + ",path=/;domain=" + mydomain;
	}

It's written for all sub pages and sub domains from root. But not sure why my cookie is writing 2 times, 1 at root and 1 at sub page, like this:
/
/abc

Regards,
Chanh Pham


More information about the TYPO3-english mailing list