开发者

How to set window.location on localhost including a hash mark under IE 8

开发者 https://www.devze.com 2023-03-22 14:38 出处:网络
I\'ve got a bookmarklet which is meant to change the current URL.The code is: javascript:location.href = \'http://localhost:8888/#nominate\'

I've got a bookmarklet which is meant to change the current URL. The code is:

javascript:location.href = 'http://localhost:8888/#nominate'

However, under IE8 this end开发者_JAVA百科s up sending the browser to: http://localhost:8888/

How do I send IE8 to that hashmark location?

Thanks.


Two things to try:

window.location = 'http://localhost:8888/#nominate';
window.location.assign('http://localhost:8888/#nominate');

The spec also allows you to set the window.location.hash value directly, but you shouldn't have to do that.

0

精彩评论

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