Jerry
Jerry

Reputation: 1007

Jquery event which triggers whenever window.location.href gets altered

Is there a way I can trigger an event whenever I alter window.location.href using jQuery?

I am using onbeforeunload but that triggers only if it is a navigation to a new url. For me the event need to be triggered even if I am altering the location.href by appending "&key" to it.

Upvotes: 2

Views: 112

Answers (1)

anshuVersatile
anshuVersatile

Reputation: 2068

window.location.watch

you can use above for your need

for further reading https://www.bennadel.com/blog/1520-binding-events-to-non-dom-objects-with-jquery.htm

Upvotes: 2

Related Questions