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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business