开发者

hide url hashtag with jquery

I need the code to hide the hashtag in the url in jQuery; I'm working on a OnePageSite and I wish to obtain "www.mysite.it" and not "ww开发者_StackOverflow中文版w.mysite.it/index.php#hashtag" when clicking on a link. This is a piece of code for Mootools 1.x; is there a way to make the same with jQuery? Thank you in advance. Best regards.

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


That code is JavaScript and not at all dependent on any MooTools functions, you can use it with (or without) any framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜