Cookies JavaScript Code Snippets

These snippets all create JavaScript Cookies. Cookies are small bits of information such as a name, a date, an order, etc. JavaScripts can set cookies on a user’s hard drive and retrieve them later, when needed.

Results via Envato Market

This cookie records the visitor’s name and writes the name, along with the visitor’s browser information to the page.

The JavaScript Cookies provide a complete set of cookie functions. Designed for usability, they make all the details, like setting expiration dates, easy and fast.

This script will greet anyone who loads the page with a confirm box. It will only display once each time someone quits the browser and comes back.

This script gives the visitors browser details. It gives the name of the browser, code name of the browser, version of the browser, default language, platform, user agent, referrer and the time and date the page was loaded.

Save a visitor’s referral ID in a cookie ID on their computer. Then, you can you can access that ID cookie from the rest of your site. Useful to help you pay affiliate commissions or track Web site referrals.

“Displays a smart info message: “”The current time is 12:52 P.M. , This is your sixth visit to this page using Microsoft Internet Explorer.”” Can also be used to trigger events depending on how often a user is visiting your page (see my homepage and then press refresh a few times – autovotes with a hidden popup on the 3rd refresh)”

Cool customization for your website, now includes choice of search engine, and, as always, news, links, weather and more! See more at

This collection will help you to set, get, and delete cookies. It’s a nice little collection that should prove to be invaluable.