开发者

Javascript 'redirect' without page reload

This question has been asked before but I need a more cross-browser* option not the git-hub one.

Is there anyway to change :

http://stackoverflow.com/test#hey

to :

http://stackoverflow.com/test

开发者_Python百科using javascript without reloading the page ? (hitting the server again)

*by 'more cross-browser' I mean IE7+ FF3.5+, not IE6, etc


You could use history.pushState() for this.

This will remove the hash:

history.replaceState( {}, '', location.href.split('#')[0] );

For cross-browser compatibility, you could use history.js as a polyfill.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜