How can I remove the query string from the url after the page loads?

前端 未结 10 1102
栀梦
栀梦 2020-12-16 10:03

I have a URL with a long query string attached to it. After the page loads, I do not require the query string. So I want to remove the query string from the address bar with

10条回答
  •  独厮守ぢ
    2020-12-16 10:33

    Use history.replaceState({}, "Title", "page.html");

    same syntax for pushState. However you will have to find a way to make IE understand that.

    A better way would be to use Apache mod_rewrite module. It's quite easy to use.

提交回复
热议问题