document.cookie= "cookiename=cookievalue; expires=Mon,12Jun2015:00:00:00; path=/;"
I run this script on my Internet Explorer 10 but it doesn't share cookie between 2 IE tab. But when i remove the "expires" properties so it seem to working :
document.cookie= "cookiename=cookievalue ;path=/;"
But i don't want to remove the "expires" properties. So how to resolve this problem ?
I have used this code since mid '90s - it has worked in all browsers on all platforms so far
Include the file and use
The following sample code will demonstrate setting a cookie of your choosing directly, without requiring input from the user. To store a cookie from your site, simply put a call to the javascript function in your HTML page, like this:
The real work is done by the cookieSet() javascript function, which can be either in the area of your HTML page, or in a separate javascript file: