How to save yourself and your browser from a web site that won't go away

The advise I'm about to give you is something I've figured out my own and seems to work, but I do not know why, if it is necessary, or if there is a better way to manage this problem. If you have a better recommendation, please add it to the comments!

Some web sites can't be safely closed. If you visit such a site and try to close the browser or tab, a dialog box pops up asking if you really want to close the page, or some such nonsense. It seems to be the case that if you click on that box, only bad things happen and the web page does not go away. The only thing you can do is crash your browser, but if you do that, your browser, being both over-engineered and stupid (as most browsers are) will helpfully open the site back up again when is restarted.

I do not have any third party anti-malware applications installed on my system, as I regard any such software to be malware itself, and I avoid using operating systems that are so vulnerable to attack as to need such overhead-hogging dangerous code running all the time. Perhaps you have such anti-malware and it takes care of this problem for you. If not, read on.

Here's what I do: 1) close all windows and browser instances except the offending tab. 2) Open a terminal. 3) Use a cli-command to kill the browser. For me, on Linux, using a current version of Firefox, what works is "killall firefox-bin"; 3) click the up-history arrow on your cli to bring the command back to the command line; 4) re-open the browser; 5) As the browser is opening, re-issue the kill command. 6) Repeat two or three times.

Normally, the browser, or at least, Firefox and related browsers with default configurations, will try to reopen the offending web site when it first comes back up, but after "crashing" a couple/few times (and you are crashing it with the kill or killall command) the browser should come up with a "mea culpa" screen asking if you want to restore the previous session or not. Say no. The offending website is gone.

This procedure will have to be adjusted for your operating system, but it works fine in Linux.

There are all kinds of reasons this may not work for you, or may not be necessary. If so, indicate what those are please.


More like this

This is one of four related posts: Should You Install Ubuntu Linux?Installing Ubuntu 16.04 LTSHow to use Ubuntu UnityThings To Do After Installing Ubuntu 16.04 LTS Some Linux/Ubuntu related books:Ubuntu Unleashed 2016 Edition: Covering 15.10 and 16.04 (11th Edition)Ubuntu 16.04 LTS Desktop:…
For today's Linux Hint: How to pick which browser will open when you pick a link while using apine in Ubuntu. Sometimes there is a URL in an email that you want to visit. In a GUI email brower, you click on it with the mouse. In apine you navigate to the link with the usual navigation keys (but…
This is the first in a series about using the "command line" in Linux. It is also about knowing when to use a gui instead. But before going into any of that we need to understand what is meant by a "command line" application. You'll find that as we explore that idea, a lot of things that are not…
I've convinced a few people to use Linux and most of them don't hate me, but most of them were masochistic geeks who were probably going to use Linux anyway. But there are three people who are pretty important to me who are now using Linux because of me, but who otherwise would not likely have ever…

Here's how I might go about it, though your particular mishap has not happened to me:

1. Kill Browser
2. Deactivate Network Interface
3. Clear Browser Cache manually
4. Start Browser
5. Close offending Tab
6. Reactivate Network Interface
7. Remember not to open weird sites.

Just thought I'd mention that the Opera browser, after a crash, will *ask* whether you want to start where you left off, or with your chosen home page, or no tabs, or whatever you want. Although, as with every good thing Opera does, there's probably some Firefox plugin that (at least tries to) do the same. I dunno.

By Ketil Tveiten (not verified) on 03 Feb 2011 #permalink

For firefox you can set the

variable by typing in the URL

and finding it in the zillions of options that show up. Click on it and set it to 0. (Default is 1) Then you can just kill firefox and it won't try to resume sessions after crashes. If you also have firefox set in general preferences to not restart the last session on start up, that helps also. (This is how I am set up.)
There is always something ... This works anywhere firefox runs I believe.

For me, on the rare occasion I stumble onto a that doesn't want me to leave, I just turn off JavaScript. so far it's worked, although it's good to know there are other ways for more persistent web issues.

I've found popups come two ways. javascript popups, which sirutka rightly points out the easiest way to stop that is to go to the menu, turn off javascript, close the offending window, and turn javascript back on.

flash can be induced to cause popups as well, for which I recommend flash blocker or something similar. which is doubly handy as popup windows are usually filled with flash.

quicktime movies also had a popup function at one point, but I think that feature was too badly abused and apple removed it from later qt players.

at least on my mac though, the couple of times I've run into serial popups, I can hit cmd-Q repeatedly faster than the javascript can open windows. given how javascript on web pages works, you have at least the length of time the browser takes to read the head of the html page before any automatic javascript handlers can take effect to close the window. i.e. the browser has to read the body tag before a body onload or onunload handler can work.

I have a firefox plugin called noscript that allows me to selectively enable javascript, so this is rarely a problem for me. I also don't often see obnoxious adds.

I do sometimes get a flash app that will crash the browser. I don't recall if it's the default behaviour or if I had to configure it, but when I start firefox back up I get a list of open windows and tabs and I can uncheck any that are causing problems while still restoring everything else I had open. Which is good because I like to keep tabs open that I plan on reading later.

To kill firefox in Windows, right-click a blank space on the taskbar and click Task Manager. Go to the processes tab and find firefox.exe. Click on it, then click the "End Process" button at the bottom right. If you get a confirmation window, click "End Now".

By richardrob (not verified) on 03 Feb 2011 #permalink

If you use Configuration Mania, an add-on for Foxfire, you can simply uncheck the box that tells the browser to restart previous session on restart after crash. Installing Session Manager, another add-on, also allows you so set restart up to ask what session to open on restart and to edit any session to delete any tab or window in any stored session.

All this should help but I've never been 'trapped' on a site in Foxfire. Closing the tab/window, often done with a quick "clear recent history, set up to clear the lot, seems to override the closure issue. I haven't had to 'crash the browser' in several years.

Spyware/malware removers are bad as long as you turn off any resident protection. I used one with good results but, here again, using Foxfire, and "clear recent history" frequently, at the very least whenever I close the browser, which is easy to set up to happen automatically, means the scanners haven't found anything, malware or virus, in a very long time.

Heavens, Greg, what kinds of sites are you surfing? Even the really obnoxious porn-spamming click-market pages don't get that outrageous, at least not in my experience.

Firefox's Flash Blocker plugin is absolutely tha' bomb. Between that and popups disabled, and of course the marvelous AdBlocker Plus, there's damned little I see online any more that I don't specifically want to see.

A bonus on AdBlocker is that you can actually locate offsite URLs in a page you're visiting, and block that domain - very handy if it happens to be causing slow page loads - and I've used it to totally lock out Meebo, which is easily the worst idea to hit the internet since IE.

Still, the trick wold seem to be finding what's causing those windows to launch, and nuking it at the source.

As already mentioned, it seems that the best solution is to use NoScript to disable javascript by default except for whitelisted sites.

If I absolutely had to use a site with bad javascript and I needed most of the javascript to run, I'd write a Privoxy filter to strip out the offending code.

Use Chrome? I haven't seen this behavior since switching. (Maybe I'm surfing the wrong porn sites.)

Just so that everyone knows, the REASON this happens o me at all is because I am testing suspicious sites from realistic looking commenters who are trying to spam YOU. This is ME laying down on railroad tracks to save YOU from stepping in the MUD!.

Just so you know.

Like some others, I have Firefox's restore-last-session option turned off, so the hard-kill option has never been necessary. Of course, this means in an unexpected browser crash (which has happened, a few times) I can't easily get back to where I was one-click-before the crash.

How do people deal with sites that spam themselves backwards through a series of open browser windows / tabs? Sometimes I'll get redirected to a site, and try to close it as Greg describes, with the "are you sure" pop-up (despite active and usually effective pop-up blocker software running). Upon (eventually) closing the offending window, I'll discover the previous Firefox window I was in has changed to the offending site. Sometimes this backwards progression through windows can extend through dozens of browser windows. Is there any easy way to stop such weird behaviour?

Also: I do not have any third party anti-malware applications installed on my system, as I regard any such software to be malware itself
Seconding this. Anti-virus and related programs cause horrible, huge drains on system resources. I'm talking about taking 10-20 seconds to open a program such as Firefox that otherwise loads in 1-2 seconds. I don't know why other people I talk to don't notice / care. It's very obnoxious, much more so than the run-of-the-mill trivial infections that my unprotected net-surfing occassionally picks up.

By TheBrummell (not verified) on 03 Feb 2011 #permalink

Safari doesn't have this problem. When you get such a site, simply quit Safari. When you relaunch it, Safari never reopens previously open windows by itself. You can do so *if you want* from the History>Reopen All Windows From Last Session menu command. Of course, you can also use the history to reopen only some of those windows.

Finally, Safari stores all its history in plain html files. You can simply edit them. That's a bit kludgy, but it can be done.

By Jean-Denis (not verified) on 03 Feb 2011 #permalink

Safari stores all its history in plain html files

That should be a requirement of browsers.

I'd also like to plug Session Manager. For me, there are many reasons to use it and this is one.

There's a specific JavaScript event that's triggered when you try to leave a page, which is what these sites hook into. I used to have that event disabled in my Mozilla config (I think this was before Firefox), but I no longer remember the details. I do remember posting about it on the Mozilla newsgroups, asking why this capability even existed, much less was enabled by default, and getting unsatisfying answers.

Anyway, yes, turning off JavaScript lets you escape, assuming that you can get to the Preferences menu.

Various flash/adblocks etc etc as mentioned earlier.

You definitely need an ongoing thread series of super nasty websites you receive via spam comments. I could see that as being fun and/or amusing. Maybe you could start America's Next Top TimeCube Guy!

By Drivebyposter (not verified) on 03 Feb 2011 #permalink

I use Firefox with three must-have extensions (I use other extensions also, but these are critical):

1. AdBlock Plus
2. Flash Block
3. NoScript

With AdBlock, I white-list some sites that I want to support (as long as they have well-behaved ads - no Flash, blinking, animation, etc.).

FlashBlock - the name says it all; of course, you can still view the Flash if you wish.

NoScript - I started using this relatively recently. It can be a pain sometimes, and there is a bit of a learning curve (which I am still on). On the other hand, it's interesting to see how much crap is hiding behind some web pages.

I see no benefit to NoScript. It seems to be good at turning all scripts off or alls scripts on. It is incapable of sensing that the dozen domains from which scripts are coming on a typical web page should be handled as one entity. Perhaps web design has gone beyond the plugin's ability. It is easier to go to preferences and turn off all scripts as needed.

Flash Block is great.

I have No Script and it allows you to block scripts from specific places like,,, etc...
You can block and allow all scripts also.
I generally don't choose to block new things's rare that I really need it. You can definitely do without it, I'm just respectfully correcting what you said.

By Drivebyposter (not verified) on 04 Feb 2011 #permalink

When I clickon the no-script thingie on a page that is annoying me, I get a list with as many as a dozen URL's none of which are the one I'm looking at. I do not have the option of simply turning off scripts on that page. Reading over a list of a dozen mostly obscure URL's and deciding which ones to turn off (or even selecting them in succession without thinking about which ones to turn off) is not a benefit to me at all.

I can block all scrips without no-script.

Perhaps it simply does not work properly on my version of firefox on my system.

This happens to me ocasionally with firefox on windows even though I have pop ups blocked. The remedy is to kill the pop up and the browser from the task manager (once will do it).

I think it was more than a coincidence that my malware problems dissappeared when the kids left home about a decade ago. I have been running windows since then with no virus checker and no malware problems. If you don't do stupid shit then windows is fine with just a simple firewall.

OTOH, I've been a software developer for 20yrs. I'm an O/S agnostic and always have been, what looks like stupid shit to me might seem perfectly reasonable to the uninitiated who often end up blaming the O/S for their gullibility.

I never said it was useful, I just said it did stuff ;-)

By Drivebyposter (not verified) on 06 Feb 2011 #permalink

I was running Firefox for some time but had some of the similar problems. Noscrip was OK but, as mentioned, you had to deal with each and every url separately. I real PITA at first but, after time, having built up a decent database of urls to block, it did its job decently, if not great.

I switched back to Safari however because flash performance "semi-broke" in a recent update to Firefox - specifically, performance of Google Maps Street View became almost unusable. Once I was back in Safari, I added AdBlock which has worked nearly perfectly for me.

Too bad Apple doesn't do a version of Safari for Linux, it really is an underrated and under appreciated Web browser.

I never said it was useful, I just said it did stuff ;-)

By Drivebyposter (not verified) on 06 Feb 2011 #permalink

I've found Firefox' WOT-tool (Web of Trust) quite useful - it stops you before going to suspicious sites. Also ESET NOD antivirus does the same.

I find "adblock" works like a charm, for those that don't have philosophical objections. If you don't trust browser add-ins, consider a filtering proxy.

I also recommend SessionManager. It saves and restores tabs and windows across sessions. You can set it so that you can choose which session to load each time Firefox is started (including reopening the tabs/windows from the previous session). I believe you can also deselect individual tabs in the session you wish to load.

Another feature is that it allows you to reopen both closed tabs and windows during the current session, in case you accidentally closed a window you meant to keep.