更改网址而不重新加载页面

时间:2014-11-13 00:34:09

标签: javascript

我如何从这种类型的网址传递:

http://domain.com

此类型:

http://domain.com/#0123456789

无需重新加载页面。

我不想使用HTML5 window.history.replaceState功能,因为它不适用于旧版本的Internet Explorer。

2 个答案:

答案 0 :(得分:1)

我找到了答案:

location.hash = "0123456789";

很抱歉回答我自己的问题......但没有答案给出了正确的观点。

答案 1 :(得分:0)

像这样:

window.location += "/#/123456";
console.log(location.hash);
相关问题