0

I am presented with the following problem: In my current web application with current browsers, the user can type in the navigation bar the name of a certain page: stackoverflow.com, when the user presses the enter button, before being redirected to the page in question, I need to update the status of a record in the database. I have tried some events in the body but if the user does it this way it does not detect them.

I have also followed the following options without success. How to detect if URL has changed after hash in JavaScript

jose lopez
  • 31
  • 3

1 Answers1

0

Well I am not sure it will resolve your problem but you could probably send your database update request in the window.onbeforeunload event like this:

window.onbeforeunload = function () { 
    // do stuff
}
FitzChill
  • 815
  • 8
  • 18