D
D
Dmitry Arushanov2017-03-16 15:14:59
JavaScript
Dmitry Arushanov, 2017-03-16 15:14:59

How do I prevent a browser tab or window from closing?

Good day to all! Such is the question. There is an extension for chrome.
Is it possible somehow when closing the browser, or the current tab - to prevent closing.
More precisely, even display your message with a warning that they say you can’t close it yet ... and so on. And depending on the user’s choice, either close the browser or not.\tab.
But before showing this message, you need to check for a certain condition, and either immediately close or show the warning described above.
Tried to use both `onbeforeunload` and looked towards chrome tabs API. everything is wasted.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question