最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to set window.location on localhost including a hash mark under IE 8 - Stack Overflow

programmeradmin2浏览0评论

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 ends up sending the browser to: http://localhost:8888/

How do I send IE8 to that hashmark location?

Thanks.

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 ends up sending the browser to: http://localhost:8888/

How do I send IE8 to that hashmark location?

Thanks.

Share Improve this question asked Jul 23, 2011 at 0:39 Lyn HeadleyLyn Headley 11.6k3 gold badges36 silver badges37 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

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)

  1. 暂无评论