Reputation: 1
I want to add an alert("some text")
message after document.location.href
or some kind of related code.
ex:
document.location.href = "http://www.msn.com";
windows.alert("You are now at msn.com");
By the moment I use document.location.href
I automatically switch site so the rest of the code isn't being done. So I would like to know if there is an other way to switch site on the same page/ not on the same page and after that put my custom code and it will be executed accordingly?
Upvotes: 0
Views: 1393
Reputation: 11148
Use the haschange
event:
$(window).on('hashchange', function() {
// your code here
});
See this post
Upvotes: 1