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

后端 未结 4 1293
温柔的废话
温柔的废话 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:41

    No, it's not possible. And, whenever it is possible, that is a browser bug (I know about previous security bugs related to this behavior, and they were fixed in past).

    Actually... You can change the last portion of the URL, anything after the # character. But the hostname and path can't be changed without leaving the page.

提交回复
热议问题