The cookies are stored in your browser for a period of 30 days and they are only accessible from the same domain as the page from which they were set.
1. The getCookie() function
To display the value of a cookie called field1 we simply use the following:
If you view the source of this page you will see that this is how the cookie values are being presented in the list above.
Each name/value pair displayed above represents a single cookie. A single cookie can hold up to 4kb of text, and for each domain name your browser will normally permit up to 20 cookies.
First, you need to add the folowing line to include the library to your HTML file:
Next; you can set a cookie using the following code:
You can also get the value of a cookie using the following code: