0

我需要代码来隐藏 jQuery 中 url 中的主题标签;我在 OnePageSite 上工作,我希望在单击链接时获得“www.mysite.it”而不是“www.mysite.it/index.php#hashtag”。这是一段 Mootools 1.x 的代码;有没有办法用 jQuery 做同样的事情?先感谢您。此致。

if(window.location.href.indexOf('#')>-1) {
  window.location.replace(window.location.href.substr(0,window.location.href.indexOf('#')));
}
4

1 回答 1

1

该代码是 JavaScript,完全不依赖于任何 MooTools 函数,您可以使用(或不使用)任何框架。

于 2010-10-06T16:04:42.860 回答