Reputation: 3822
I've got a simple event listener:
window.onhashchange = function(e){
alert(e.newURL);
}
that works great in anything but IE 9 (not testing for previous version). In IE I'm getting an undefined event object... Any idea what I'm missing? Is this not fully supported yet?
example here:
http://hupcapstudios.com/projects/hash.php#
Thanks in advance.
Upvotes: 1
Views: 1011
Reputation: 42632
Some older versions of IE9 don't pass the event as an argument to the event handler, you have to get it from window.event
, this should work:
window.onhashchange = function(e){
e = e || window.event;
alert(e.newURL);
}
Upvotes: 2