Going back in history skips the same page with a different query string

When I refresh the page or redirect it to the same URL, I can click the "window.history.back ()" button; code and return to the previous page.

However, if the query string has been changed, I just go back to the same page when I try to go back.

Example 1:

page1.html → page2.html → page2.html → [back button] → page1.html

Example 2:

page1.html → page2.html → page2.html? x = 123 → [click back button] → page2.html

What I want:

page1.html → page2.html → page2.html? x = 123 → [click back button] → page1.html

, , , JavaScript, ?

+3
1

<a href="page2.html?x=123" 
onclick="location.replace(this.href); return false">Next</a>

+2

All Articles