Using JavaScript and Cookies
Here is some code I found to create cookies using Javascript. This code uses Persistent Client State HTTP Cookies to store information about how many times the browser has visited this page and when was the last time the broswer loaded the page. This example stores the two cookies on the reader's hard disk including how many times the page has been viewed by this browser and the date of the last visit.
Here is an example of how this can be used:
Hello, !
Reload this page to see this change.
How to use this Javascript:
Include the Javascripting included in the head of this document.
Make sure you rename the constants 'my_LastVisit'
and 'my_NumVisits'
in Javascript are something unique for your page. If you do not then other pages that use this code will interfere with your count and date.
To output the text, use this code inside the BODY section to display the information in the browser: