Can I listen to window.location.replace change js?
If a user clicks on a submit button, and a specific function will handle the event(checks/validates and redirects user to another page.)
What I want is to execute a function before redirecting.
I can't edit the validation part.
I have to listen to window.location.href 's change or a command to change it.
Can I know if a page is being redirected and prevent it happening the redirect to run a piece of my code?