onbeforeunload in Opera

后端 未结 4 1693
后悔当初
后悔当初 2020-12-06 17:30

I\'m using the code that netadictos posted to the question here. All I want to do is to display a warning when a user is navigating away from or closing a window/tab.

相关标签:
4条回答
  • 2020-12-06 17:34

    onbeforeunload is now supported in Opera 15 based on the WebKit engine but not in any prior versions based on Presto.

    0 讨论(0)
  • 2020-12-06 17:46

    Opera does not support window.onbeforeunload at the moment. It will be supported in some future version, but has not been a sufficiently high priority to get implemented as of Opera 11.

    0 讨论(0)
  • 2020-12-06 17:47

    Have you tried this?

    history.navigationMode = 'compatible';
    

    Reference, found via this page

    I haven't actually tried it myself, but it looks promising.

    0 讨论(0)
  • 2020-12-06 17:51

    Mobile Safari (iPhone/iPad) also doesn't support onbeforeunload, and I strongly suspect it is not likely to.

    For detecting back/forward navigation there may be workarounds e.g. see Is there an alternative method to use onbeforeunload in mobile safari?.

    0 讨论(0)
提交回复
热议问题