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 is A.htm B.htm C.htm three pages
A.htm has this sentence: document.location.href="/b.htm";
b.htm has this sentence: 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 retained in the actual memory: A, B, C
2: When rolling back to B , the C page is cleared out of 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,
A and B are retained in the memory
>>> When a document is replaced by location.replace(), it is removed from the current history object