spacer
Yehuda Shiran January 20, 2000
The history Object
Tips: January 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

The history list is represented in JavaScript by the window.history object. This object lets you deal with the history list but not with its exact data. That is, the URLs maintained in that list cannot be extracted or otherwise modified by a script. The only property of this object is its length. Its methods enable you to load the list's entries but not to manipulate the URL explicitly. Since the history object is a property of the topmost window object, you have the option to refer to it as window.history or simply history.

You can access the number of entries in the history list via the history.length property. It works exactly like the strings' and arrays' length property. You can use this property to find how many pages the user has visited lately:

if (history.length) > 10
  alert("You've already accessed " + history length + " Web pages this session");
else
  alert("You've only accessed " + history.length + " Web pages this session");


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint