Introduction to JavaScript History objects

Source: Internet
Author: User

History objects
The History object contains a Url,history object that is accessed by the user (in a browser window) as part of a Window object that can be accessed by the Window.history property, without the public standard applied to the History object. However, all browsers support this object

History Object Properties
Length declares the number of elements in the browser history list
Grammar: history.length;
Example: document.write (history.length); Output 45

History Object method
Back () load the previous URL in the History list (if present), the effect of calling the method is equivalent to clicking the rewind button or calling History.go (-1)
Syntax: History.back ();

Forward () loads the next URL in the History list, and the effect of calling the method is equivalent to clicking the Forward button or calling History.go (1)
Syntax: History.forward ();

Go () Loads a specific page in the History list, the URL parameter uses a URL to access, or a substring of the URL, and the number parameter uses the relative position of the URL to be accessed in the History URL list
Syntax: History.go (number| URL);
URL test, did not achieve the desired test results, do not know what is going on, if you know, say it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.