0

How can I detect whether onunload event is triggered by browser close or tab close?

I have onunload event captured in the application and that works fine - to warn the user before leaving page. However, in case there are multiple tabs of the application open and if user selects to close the browser, user gets a prompt if he wants to close all tabs. Now, after hitting close all tabs, I do not want user to individually attend prompt(raised by onunload event) on all the tabs. If close all tabs is clicked onunload should be disabled.

So, can I capture that whether close all tabs is clicked in onunload event?

niksvp
  • 5,545
  • 2
  • 24
  • 41
  • @mplungjan - the link [https://stackoverflow.com/questions/3888902/detect-browser-or-tab-closing] that you have marked duplicate does not answer my question. I want to determine the click of Close All Tabs button instead of browser or tab close. Edited question title. – niksvp Aug 12 '19 at 14:01
  • The answer is still “not possible “ – mplungjan Aug 12 '19 at 14:11

0 Answers0