0

I want to achieve something like this

Expect result 1

with clean history

Expect result 2

I want to do in <a> tag look like <a href="...?theme=dark...">

or I need to do in javascript with something like window.location.href... = mainURL + '?theme=dark'

How to achieve like the images above?

addition question: How to also possibly achieve in IE?

zummon
  • 906
  • 3
  • 9
  • 27
  • 3
    Does [this](https://stackoverflow.com/questions/824349/how-do-i-modify-the-url-without-reloading-the-page/3503206#3503206) answer your question? – Thum Choon Tat Oct 06 '20 at 02:26
  • Thank guys, I'm new to `history.pushstate...` I also try but is it good practice to do like `window.history.replaceState('','','?theme='+ obj.theme)` right now it works for me. by the way `obj.theme = 'dark'` – zummon Oct 06 '20 at 03:04

0 Answers0