1. Technology
Send to a Friend via Email

First Time Only

1. Introduction and Sample

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Get the Script

When this page finished loading in your browser you should see an alert pop up with "Welcome" in it. At least that is what you should see the first time that you visit this page. If you have visited the page before during your current browser session then you will not see that alert.

That alert is just an example. The purpose of this script is to determine whether this is the first time that a web page has been accessed in this browser on this computer and if it is to perform a given piece of processing (in the example on this page it calls the alert with the welcome message).

How the script works is that it tests for the existance of a particular cookie and then checking if that cookie contains text that matches the filename of the current page (without the extension). If the appropriate cookie exists and has that content then the script assumes that you have visited the page before.

Because the script uses session cookies nothing is actually written to your visitor's computer and the cookie will be automatically removed when they close their browser.

If this is what you need to be able to do on your page then the next step is to obtain the script.

Sample Page | Obtain the Script
See More About

©2014 About.com. All rights reserved.