How to change the URL displayed in the browser without leaving the page

后端 未结 4 1309
温柔的废话
温柔的废话 2020-12-01 13:31

Is it possible with JavaScript to change the browser\'s URL, but not leave the page?

4条回答
  •  天涯浪人
    2020-12-01 13:42

    You can change anything after the hash mark (#) as this is frequently used in Ajax applications such as Google search and the new Twitter. (That's why everything appears after the hash mark in those apps.) But if you change anything else, the page will have to be reloaded.

提交回复
热议问题