I\'m developing one of those warning windows that tells the user that they may have unsaved data, but I only need it to warn them if they\'re leaving the page. Currently it
on beforeunload event we can do below things:
For example document.activeElement will give you the last element you clicked that caused the page unload.
Hope this helps!!