Jump to content

Recommended Posts

Hello Everyone,

 

Now this is the issue which i m not understanding at all.

 

I m creating a cookie with folowing code

 

function setCookie(name,value){    
		 var ExpireDate = new Date ();
		 ExpireDate.setTime(ExpireDate.getTime() + (1 * 24 * 3600 * 1000));
		 document.cookie = name+"="+value+";expires="+ExpireDate.toGMTString()+"; path=/";	
    }

.

The point is cookie is being created but it does not show the expiry date, when i call document.cookie in firebug it gives me following output

 

"JSESSIONID=C5A6A2C72DC227F44D332B6FF194356F; Institute=4; Stream=3; Course=12".

 

But when i change the semi-colon with exclaimation mark in this sentence before the word "Expires"

 

document.cookie = name+"="+value+";expires="

 

as this

 

document.cookie = name+"="+value+"!expires="

 

then it gives me this output

"JSESSIONID=C5A6A2C72DC227F44D332B6FF194356F; Institute=5!expires=Tue, 08 Nov 2011 09:38:55 GMT; Stream=5!expires=Tue, 08 Nov 2011 09:38:56 GMT; Course=3!expires=Tue, 08 Nov 2011 09:38:57 GMT"

.

 

Can anyone please explain this behaviour!!!

 

Any help will be highly appreciated ;)

Link to comment
https://forums.phpfreaks.com/topic/250606-cookies/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.