Lyn Headley
Lyn Headley

Reputation: 11598

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

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.

Upvotes: 5

Views: 6594

Answers (1)

jfriend00
jfriend00

Reputation: 707876

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.

Upvotes: 4

Related Questions