Both document.location.href and document.location.replace can switch from page A to page B, but their difference is:
After switching with document.location.href, you can return to the original page.
After switching with document.location.replace, you cannot return to the original page through "Back".
Regarding document.location.href or other reversible switching methods, I also found a detail,
Use an example to illustrate:
Suppose there are three pages A.htm B.htm C.htm
There is this sentence in A.htm: document.location.href="/b.htm";
There is this sentence in b.htm: document.location.href="/c.htm";
Note that both are reversible switches.
1: When switching from A to B and then to C, three pages are reserved in the actual memory: A, B, C
2: When rolling back to B, the C page is cleared from the memory!
3: Go back again. When page A is reached, page B is also cleared from the memory!
4: When moving forward again (not by switching but by forward) to page B,
What is kept in the memory is A and B
>>>When a document is replaced by location.replace(), it will be removed from the current history object