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

前端 未结 5 1092
佛祖请我去吃肉
佛祖请我去吃肉 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:36

    You can't change the value in the address bar without redirecting. That would be a phishing scammer's dream come true!

    You can, however, change the fragment identifier: (in JavaScript, the window.location.hash value)

    
    
    
    This is a test
    
    
    

    But changing the query string will redirect the page.

提交回复
热议问题