title: Event when window.location.href changes
body: <p>I'm writing a Greasemonkey script for a site which at some point modifies <code>location.href</code>.</p>
  
  <p>How can I get an event (via <code>window.addEventListener</code> or something similar) when <code>window.location.href</code> changes on a page? I also need access to the DOM of the document pointing to the new/modified url.</p>
  
  <p>I've seen other solutions which involve timeouts and polling, but I'd like to avoid that if possible.</p>