Friday, 25 October 2013

What is Cookies ?

Web Browser and Server use protocol protocol to speak and protocol could be a homeless protocol. except for a poster web site it's needed to keep up session data among completely different pages. as an example one user registration ends when finishing several pages. however a way to maintain user's session data across all the net pages.

In several things, mistreatment cookies is that the most effective technique of memory and pursuit preferences, purchases, commissions, and alternative data needed for higher traveler expertise or web site statistics.

How It Works ?

Your server sends some knowledge to the visitor's browser within the variety of a cookie. The browser might settle for the cookie. If it does, it's hold on as an evident text record on the visitor's disk drive. Now, once the traveler arrives at another page on your web site, the browser sends constant cookie to the server for retrieval. Once retrieved, your server knows/remembers what was hold on earlier.

Cookies square measure an evident text knowledge record of five variable-length fields:

Expires : The date the cookie can expire. If this is often blank, the cookie can expire once the traveler equal the browser.

Domain : The name of your web site.

Path : the trail to the directory or web content that set the cookie. this could be blank if you wish to retrieve the cookie from any directory or page.

Secure : If this field contains the word "secure" then the cookie might solely be retrieved with a secure server. If this field is blank, no such restriction exists.

Name=Value : Cookies square measure set and retrieved within the variety of key and price pairs.

Cookies were originally designed for CGI programming and cookies' knowledge is mechanically transmitted between internet|the online|the net} browser and web server, thus CGI scripts on the server will browse and write cookie values that square measure hold on on the shopper.

JavaScript may also manipulate cookies mistreatment the cookie property of the Document object. JavaScript will browse, create, modify, and delete the cookie or cookies that apply to the present web content.

Storing Cookies:
The simplest thanks to produce a cookie is to assign a string price to the document.cookie object, that feels like this:

No comments:

Post a Comment