Differences between Document. location. href and. replace
Both document. location. href and document. location. replace can be switched from page A to page B. The following describes their differences.
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 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