jQuery - 如何在不重新加载的情况下更改URL? [重复]

时间:2022-08-26 11:28:28

Possible Duplicate:
Modify the URL without reloading the page

可能重复:修改URL而不重新加载页面

Is there a way for jQuery to change the url without reloading?

有没有办法让jQuery在不重新加载的情况下更改url?

Tried changing window.location and every time I change it, it automatically reloads the page.

尝试更改window.location并每次更​​改它时,它会自动重新加载页面。

1 个解决方案

#1


1  

The only part of the url you can change without reloading is after the hash, #. Any changes to the url before that will be considered a different page and will trigger a reload.

您可以在不重新加载的情况下更改网址的唯一部分是哈希值#。在此之前对URL的任何更改都将被视为不同的页面,并将触发重新加载。

#1


1  

The only part of the url you can change without reloading is after the hash, #. Any changes to the url before that will be considered a different page and will trigger a reload.

您可以在不重新加载的情况下更改网址的唯一部分是哈希值#。在此之前对URL的任何更改都将被视为不同的页面,并将触发重新加载。