Join TalkersCode Now !

Get Latest Tutorials And Links On Web Development
And Get Existing Offers Via Email

Javascript Cookies

Javascript Cookies

Cookies are used to store information on user device like computer, mobile phones etc. You can store create cookies, access cookies and delete cookies.

You can set as many Cookies as you want.You can also set cookies with the help of PHP.

Create Cookies


document.cookie = " key1=value1; key2=value2; key3=value3; expires=date/time ";

Example of Creating Cookies

document.cookie = " name=Rahul; course=BCA;expires=Sun,18 Jan 2015 12:00:00 UTC ";

Read Cookies

var allcookies = document.cookie; document.write(allcookies);

document.cookie statement will give all the cookies into allcookies variable.

Then It display all the cookies like this name=Rahul; course=BCA;

Delete Cookies

You can delete the cookie by setting that keyname and set the expires value to the passed date.

document.cookie = " name=Rahul; course=BCA;expires=Sun,18 Jan 1915 12:00:00 UTC ";

This will delete the name cookie and course cookie.


Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email

Are You Starting A New Blog
Do You Want Best Web Hosting?

Try World's Best Web Hosting Provider BlueHost
At Just $3.95/mo

Hurry Up! Limited Time Offer

Yes, I Want To Check Out BlueHost

Check The World's Best SEO And All-In-One Marketing Toolkit
For Digital Marketing Professionals SEMRUSH