Differences between document. Location. href and. Replace

Source: Internet
Author: User

Both document. Location. href and document. Location. Replace can be switched from page a to page B, but their differences are:

After switching with document. Location. href, you can return to the original page.

After switching with document. Location. Replace, you cannot return it back to the original page.

For document. Location. href or other failback methods, I also found details,

Here is an example:

Assume there are three pages: a.htm B .htm c.htm.

A.htm has the following sentence: Document. Location. href = "/B .htm ";

B .htm has the following sentence: Document. Location. href = "/c.htm ";

Note that both of them can be switched back.

1: when switching from A to B and then to C, the actualIn MemoryThree pages are retained: A, B, and C.

2: when it is rolled back to B, the C page is cleared out of memory!

3: Roll Back again. When page a is reached, page B is also cleared out of memory!

4: When you go forward again (instead of switching, but forward) to page B,

The memory retains a and B.

>>> When a document is replaced by location. Replace (), it will be removed from the current historical object

 

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.