How to remove parameters in URL and display it in address bar without causing redirect in Javascript?

前端 未结 5 1084
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 03:36

I have found numerous answers on how to extract the URL without the parameters.

How do you rewrite the URL in the address bar without causing the page to reload with

5条回答
  •  一整个雨季
    2020-12-11 04:35

    You might be able to use the new pushstate that is part of the HTML 5 history API, which allows you to change the URL without actually reloading the browser.

    Check http://badassjs.com/post/840846392/location-hash-is-dead-long-live-html5-pushstate for a quick example, and http://diveintohtml5.info/history.html for more in depth examples and limitations:

提交回复
热议问题