Send to a Friend

ETpro's avatar

What's a safe and easy way to close a page with a "Do you really want to leave this page" popup?

Asked by ETpro (34605points) May 16th, 2013

There are legitimate reasons for developers to use a JavaScript to nag you about the consequences of closing a page or tab. Gmail, for instance, uses the onBeforeUnload event handler to prevent your unwittingly leaving a page with unsaved work that would be lost onUnload. So I don’t want to block the onBeforeUnload and onUnload handlers.

But nefarious sites often craft a popup that asks “Do you really want to leave this page” and offer a “Yes” and “No” button, both of which are actually redirects to scripting and at worst case, even disguised permission buttons agreeing to let the site modify your system and thus install malware. Same goes for the X in the upper right corner of the popup.

In Windows, you can use the three-fingered salute to access the Task Manager, then close the browser. Reopening it will generally take you right back to the page, but on the second close and reopen, the browser should recognize that something is wrong, and ask you if you want to reset or open all previous tabs. However, there are clever tricks scum-bucket developers can use to prevent that from working.

What’s an easy way to defeat one of the hellishly persistent “do you really want to leave” popups without putting yourself at risk for a malware infection? If they haven’t disabled right click, won’t right click and close kill the popup in a safe manner, not allowing it to use your action as a permission to alter your system? If even right click has been defeated, how do you escape the loop short of using a program like CCleaner to purge all temporary files and clean up bad registry key entries. It takes a lot of time and effort to recover the wanted stuff CCleaner hoses, so that has to be the method of last resort.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.