1. Home
  2. Computing & Technology
  3. JavaScript

First Time Only

2. Obtain the Script

clr gif
Join the Discussion

Questions? Comments?

More of this Feature

Introduction

To add first time only processing to your web page you first need to copy the Javascript code into the head section of your page.

Copy the above Javascript and save it to an external file. I called mine firsttime.js.

We can now link the Javascript into the head of our web page using the following code:

<script type="text/javascript" src="firsttime.js"></script>

The final step is to replace the alert('welcome'); statement with whatever processing it is that you want to have performed only on the first visit to the page.

Introduction and Sample | Obtain the Script
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.