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.

Comments

  1. #1 Richard Prins
    February 3, 2011

    You could also disable restore, if you don’t like it. See various options: http://kb.mozillazine.org/Session_Restore

    Maybe a one-time start in safe-mode might be useful too (also available via command line)

  2. #2 dargndorp
    February 3, 2011

    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.

  3. #3 Ketil Tveiten
    February 3, 2011

    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.

  4. #4 markk
    February 3, 2011

    For firefox you can set the
    browser.sessionstore.max_resumed_crashes

    variable by typing in the URL
    about:config

    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.

  5. #5 Sirutka
    February 3, 2011

    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.

  6. #6 peter
    February 3, 2011

    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.

  7. #7 richardrob
    February 3, 2011

    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”.

  8. #8 Art
    February 3, 2011

    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.

  9. #9 Warren
    February 3, 2011

    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.

  10. #10 Ivan
    February 3, 2011

    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.

  11. #11 Lorax
    February 3, 2011

    Probably fewer trips to internet porn sites would reduce this from happening. Just a thought.

  12. #12 tarian
    February 3, 2011

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

  13. #13 Greg Laden
    February 3, 2011

    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.

  14. #14 TheBrummell
    February 3, 2011

    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.

  15. #15 Jean-Denis
    February 3, 2011

    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.

  16. #16 Greg Laden
    February 3, 2011

    Safari stores all its history in plain html files

    That should be a requirement of browsers.

  17. #17 PaulPaul
    February 3, 2011

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

  18. #18 Nemo
    February 3, 2011

    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.

  19. #19 Drivebyposter
    February 3, 2011

    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!

  20. #20 uqbar
    February 4, 2011

    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.

  21. #21 Greg Laden
    February 4, 2011

    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.

  22. #22 Drivebyposter
    February 4, 2011

    I have No Script and it allows you to block scripts from specific places like google-analytics.com, kqzyfj.com, quantserve.com, doubleclick.net etc…
    You can block and allow all scripts also.
    I generally don’t choose to block new things though…it’s rare that I really need it. You can definitely do without it, I’m just respectfully correcting what you said.

  23. #23 Greg Laden
    February 4, 2011

    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.

  24. #24 Alan
    February 5, 2011

    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.

  25. #25 Drivebyposter
    February 6, 2011

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

  26. #26 Jeff Knapp
    February 6, 2011

    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.

  27. #27 Drivebyposter
    February 6, 2011

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

  28. #28 UBS
    February 6, 2011

    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.

  29. #29 paulmurray
    February 6, 2011

    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.

  30. #30 CS
    February 7, 2011

    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.

Current ye@r *