Webocreation

Sunday, November 1, 2009

Cookie management in web technology

A cookie management system serves as a central storage location for information and other data on users. A user's machine contains a cookie having a key and the cookie management system associates user information with this key. Upon receiving a request from a user, a web site retrieves the key from the user's machine and queries the cookie management system for the user information. The cookie management system retrieves the data associated with the key and returns the user information to the site. The sites therefore do not need to store information on all users nor do they need to place their own cookies on the user's machine. If sites obtain more data about a user during an interaction, the sites send this data to the cookie management system which updates its database. The user's machine may contain multiple cookies that correspond to different people and the site can prompt the user to select the appropriate one. The cookies may correspond to the same user and specify different amounts or categories of information. The user may supply a password to enable sites to access their data from the cookie management system.

JavaScript cookies are stored in the document.cookie object and are created by assigning values to this object. When creating a cookie, you typically specify a name, value, and expiration date and time for that cookie. The cookie will then be accessible in your scripts every time the user returns to your site until the cookie expires. These cookies will also be sent to your server every time the user requests a page from your site. The simplest way to create a cookie is to assign a string value to the document.cookie object, which looks like this:
name=value; expires=date

<head>

<script language=”JavaScript”>

document.cookie = “myCookie=” + escape(“This is my
Cookie”);

</script>

</head>

No comments:

Post a Comment