Differences between Document. location. href and. replace
Source: Internet
Author: User
Document. location. href and document. location. replace can be switched from page A to page B. The following describes the differences between them in document. location. href and document. location. replace can both switch from page A to page B, but the difference is:
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 actual memory retains three pages: 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
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.