2

I am trying to detect changes in window.location (for example to be notified if the user tries to reload the page) but I can't seem to find a way to do that. Are there some events associated with it?

Thanks

Luke Morgan
  • 1,900
  • 2
  • 14
  • 18

1 Answers1

4

The unload event is fired when the user leaves the page. There's also a beforeunload event in some browsers, but it's not supported in Opera.

Community
  • 1
  • 1
Emil Vikström
  • 90,431
  • 16
  • 141
  • 175