[removed]: Is it possible to get any details about how the window was unloaded?

前端 未结 4 1108
感动是毒
感动是毒 2020-12-16 22:00

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

4条回答
  •  天涯浪人
    2020-12-16 22:45

    I think that the active element is not a valid solution.

    I can't comment the "open and free" solution, I dont have reputation.

    document.getActiveElement gets the currently focused element in the document. If a link have the focus and I press F5 or I close the tab the active element is the link.

提交回复
热议问题