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 (
34605)
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.
Observing members:
0
Composing members:
0
22 Answers
Stop looking at so much porn man :P
@uberbatman If it were only porn sites, then it would be dead simple to avoid. It’s on all sorts of high power marketing sites, and you never know whether it’s just a salesman trying to stick his foot in the door or something far more pernicious. Whatever the source, I’m looking for how to safely kill the popup without having to disable JavaScript.
^^^Puhleeeez let me know when ou figure this out.
@ETpro I only encounter those pop-ups with porn lol. Torrents and such save me there :P As for your problem, haven’t got a clue sir, hopefully someone comes along who knows.
I usually just exit my internet connection. If that fails, I turn the machine off and start over.
Irritating but it seems to keep me out of trouble.
@Espiritus_Corvus & @uberbatman Waiting is. Hopefully one of our resident nerds will chime in with a simple and quick way to escape the trap.
@rojo I’ve had to go that route as well, but what a hassle. At least now that I am signed up wit Web of Trust I can go there, vote the site down to zero, and record what bad behavior inspired the low rating. There is some satisfaction in that.
There’s a new guy in town. I asked him over to see if he knows.
Can you go to the task manager and automatically close down your browser.
@Espiritus_Corvus Thanks.
@Bellatrix I mentioned doing just that in the question details. Read those for why that’s a less-than-perfect solution. Also, the one I hit today was clever enough to keep reopening the browser with all previous tabs open. I only escaped it by closing down the browser tab involved before it could fully load.
Personally I turn off the ‘re-open last session launch’ type features. I have bookmarks and homepage for that.
Then using the task manager to close the browser is the end of the story.
I must have something set in Firefox that means it seems to always ask me if I want to reopen all the tabs. So I can say no. I mustn’t visit sites that create this problem. I can only recall it happening a couple of times.
@dabbler & @Bellatrix I’ll go figure out how to configure Firefox like that. I’ve got Chrome set up that way already. I should have thought of that solution myself, but somehow I needed somebody to jump-start my brain.
I set it to always reopen after a shut-down or crash on a blank page.
I almost never run into this. On the rare occasions that I have, I’ve used xkill to shut the browser down, and then on restarting the browser I close the tab before its page has a chance to load. I also use NoScript in Firefox for untrusted browsing (that is, I don’t use other browsers at sites I haven’t checked out already.)
I haven’t used Windows in a while, but iirc the stock task manager doesn’t offer an option analogous to ‘kill -9’. I recommend the use of the Sysinternals Suite to any Windows administrator (that is, everyone whose Windows machine is not managed by someone else) and in particular Process Explorer. procexp offers a lot of good features the stock task manager lacks, including more signals, a top-like tree view, and fine-grained renicing.
IIRC you’re a firebug user, so you are probably able to identify the offending script when you run into this problem (I don’t use firebug, even though I probably should, so I don’t know exactly what it can do.) NoScript can block scripts by domain, so if it’s a cross-site attack it should still work. The only “gotcha” I can think of is that changing script permissions often causes NoScript to force a refresh, which might or might not trigger the evil script.
@rexacoracofalipitorius Welcome to Fluther. Love your avatar. Those 4 circles drove my eyes crazy for a while.
Thanks for a ton of useful info. I will definitely follow up on those recommendations. Unfortunately, the function of Firebug fires the onBeforePageUnload handler in order to initiate its separate pane, so it can’t be opened once a script reacting to that handler is in operation to prevent closing the window having focus. But Firebug is an absolute delight for web developers doing HTML, CSS, or scripting.
I understood absolutely none of that. I’ll just come runnin’ when I get into trouble. Thanks, guys.
@Espiritus_Corvus Here’s the important part: NoScript. Don’t browse without it!
Of course that means, “Don’t browse with Internet Explorer”- which you shouldn’t anyway :^)
Open your task manager (ctrl, alt, delete) and end the task. I never even click on the close button for pop-ups.
@genjgal Busted. You didn’t read the question details. :-)
Response moderated (Spam)
Answer this question
This question is in the General Section. Responses must be helpful and on-topic.