0

我需要将用户重定向到另一个页面,我使用了 window.location.hash = "../pagePath.html"; 但它会在不触发 JavaScript 代码的情况下重定向到页面,这是一些 jQuery Mobile 解决方案吗?我可以在 JS 代码中使用类似“ajax-false”的东西?

4

1 回答 1

3

你需要使用

window.location.href="../pagePath.html";

然而

window.location.hash 

将从 url 返回锚值。例如:您的浏览器网址是 www.google.com/accounts#gmail 如果您像这样获得 window.location.hash

var anc=window.location.hash;

然后将返回“gmail”。

于 2012-07-12T20:46:32.057 回答