I checked a lot of information and found out that there is a onbeforeunload
method, which is triggered when the tab is closed. If the return value is string (true/false will also be converted to string), the browser's default pop-up window will be called. Prompt the return value (but in fact, the new version of the browser has ignored the return value and directly uses the browser's default prompt statement)
But I think some companies can pop up a custom pop-up window when closing a tab, such as the promotional advertisement of Ve
, I have seen it implemented.
Ve
’s demonstration link, there is a demonstration at 1:30 seconds of closing the browser to pop up a custom pop-up window
I don’t know if you have encountered similar needs or have any good ideas. You can also mention them. Thank you everyone~
onbeforeunload Since it is a method, you can control the display of the custom pop-up window when this method is triggered