As we have a wonderful concept called hooking where we can create a reference to a function and connect another function In the same way can we create a reference to DOM objects. For example can we create a function and hook it to document.location so that whenever document.location is used the other function must be triggered.
window.location.href. Assigning that property to a value triggers the event to change pages, though I'm not sure if it's an overrideable feature in javascript or if it's somehow treated differently by the browser.