I need a way to attach some pre-processing to each assignment of the window.location. Is there a way to do this. I basically need to serialize some info, that will be used in the new location.
I need a way to attach some pre-processing to each assignment of the window.location.
Share
You can use the
beforeunloadevent to trigger your code to run prior to navigation… If you need something more specific (e.g., only navigations initiated in your code), then I recommend that you factor out code changingwindow.locationinto a separate function, and add a hook for your custom logic.