Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 984
Lyn Headley Avatar asked Oct 10 '22 10:10

Lyn Headley


1 Answers

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.

like image 51
jfriend00 Avatar answered Oct 20 '22 05:10

jfriend00