We're calling on all EU-based Mozillians with iOS or iPadOS devices to help us monitor Apple’s new browser choice screens. Join the effort to hold Big Tech to account!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I force a window to close if it continually opens dialog boxes asking to confirm

  • 13 tontu
  • 99 am na jafe-jafe bii
  • 4 views
  • i mujjee tontu mooy miffed214

more options

I have come across pages from time to time that try to prevent me from closing them by continuously opening dialog boxes. Generally these come up as pop-ups or hidden redirects from other pages, rather than from a site that I actually intended to visit. The only fix that currently works is to drag the offending tab into it's own window and ignore it. This allows me to continue browsing, but the only way to get rid of it is to force quit Firefox.

When I did a web search for a way to prevent any further dialogs from opening from a given page all I could find were repeated requests to get rid of the feature and no way to get it back now that it's gone.

My suggestion would be to make an option available, if it does not already exist and easily accessible to force close a tab. This action should kill any scripts that it might be running and close it with out permitting any dialog boxes, pop-up windows or any other action. Placing it in the right click menu alongside "close tab" would be ideal, though if this is considered dangerous in the hands of the average user then create it and use a preferences bit to enable it so advanced users can enable it themselves.

I have come across pages from time to time that try to prevent me from closing them by continuously opening dialog boxes. Generally these come up as pop-ups or hidden redirects from other pages, rather than from a site that I actually intended to visit. The only fix that currently works is to drag the offending tab into it's own window and ignore it. This allows me to continue browsing, but the only way to get rid of it is to force quit Firefox. When I did a web search for a way to prevent any further dialogs from opening from a given page all I could find were repeated requests to get rid of the feature and no way to get it back now that it's gone. My suggestion would be to make an option available, if it does not already exist and easily accessible to force close a tab. This action should kill any scripts that it might be running and close it with out permitting any dialog boxes, pop-up windows or any other action. Placing it in the right click menu alongside "close tab" would be ideal, though if this is considered dangerous in the hands of the average user then create it and use a preferences bit to enable it so advanced users can enable it themselves.

All Replies (13)

more options

You can go in the windows process manager and you click on process. You select firefox.exe (or firefox.exe*32 if you have Windows 7 or 8) and you click on Kill process. If you wan't, there is a program for advanced user to kill process : process explore. There is the link to download it here : http://technet.microsoft.com/en-gb/sysinternals/bb896653.aspx

more options

Thanks LeGeekDuOpenSource, unfortunately that's just the Windows version of the workaround that I'm currently using. On the Mac it's Force Quit but the effect is the same - it kills all Friefox windows but cannot selectively kill individual windows or tabs.

more options

There are so many ways to abuse the reader... I don't think the built-in features will ever be able to block all of them.

What kind of dialogs are you getting? The block on repeated dialogs (alerts, for example) generally applies to those that repeat within a script. If the page reloads in between, or other events intervene, that likely would bypass the block.

Related threads regarding "onbeforeunload" ("do you want to leave") problem:

more options

Those other posts look like the same type of error - typically they are "Are you sure you want to leave?" Type messages in a continuous cycle

I was hoping there might be a feature or plugin to kill scripts within a given tab or window.

more options

I don't know if a pluggin exist ... Sorry. I don't have a mac.

more options

I had this problem. Jscher2000's suggestion worked for me this way: I moved the persistent tab to a new window and observed its refresh cycle; when the script was mid-refresh I pushed ALT+F4 (close window).

Also, within the persistent "Confirmation" prompt windows produced by a different page there was a checkbox titled "Prevent this page from creating additional dialogues", which I presume/hope was placed there by Firefox and was not malicious (it may be a feature of my Firebug addon, but I'm not sure). I checked the box, which forced the page to reload, and during the reload I pressed ALT+F4 to close the window.

tl;dr:

await script refresh>ALT+F4 (Windows, close window) OR
check "disallow future dialogs">await script refresh>ALT+F4

mheisser moo ko soppali ci

more options

I could try the close window mid-refresh option if there's time to catch it. The "disallow future dialogs" isn't present in the standard firefox so it could be a feature of one of your add ons. Either way, firebug might be suitable for such pages by simply pausing the scripts prior to closing the page...

more options

Hi ben_burrowes, the disallow future dialogs checkbox appears on normal sites, no add-on required, but apparently some sites have found a way around it.

In a thread about a different inescapable website problem a user suggested gutting the page using the Inspector. I haven't tested it on the kind of page you're encountering, but here's how you would do it: right-click a blank area near the margin of the page, and choose Inspect Element (Q). This should open a panel with some element of the page's HTML code selected. You're looking for the <body> tag, scroll up if necessary, then right-click it and choose Delete Node. You also could delete the <head> node. There's a good chance this will cripple the script that's preventing you from leaving the page. Obviously not an approach you would want to have to use often, but you could practice it for potential emergencies.

more options

I found the following fast way to close Firefox page on Windows with Firefox 26:

- Press F12. This will open developer tools pane.

- Click on star icon on the left. This should open Toolbox options.

- check Disable Javascript (Current version only, reloads the page).

- while page is reloaded, close it by clicking on close (cross) icon or use Alt+F4 or whatever you prefer.

Note that the previous advise to use right click and Inspect Element (Q) does not work because most pages block right clicks these days. But F12 appears to always work. I guess there should be a similar sequence on Mac.

more options

Hi jhnlmn, that's a great find. F12 should work on Mac and Linux, too.

(I can't test it at the moment, as my security software is blocking the bad site I know about.)


In another thread, I posted a different workaround, a script to clear out the contents of the page that should allow it to be closed. You can add it to your Bookmarks Toolbar for future use in the unfortunate event that you run into one of these pages.

How to use it:

First, click the Stay on Page button so there are no pop-ups active.

Then, if you already installed the bookmarklet, click the Escape button.

If you haven't already installed it, open a new tab (Ctrl+t) or new window (Ctrl+n) and go to my bookmarklet page:

http://dev.jeffersonscher.com/bookmarklets.html#escape

If you do not normally display the Bookmarks Toolbar, you can add it to (or move it to) the Bookmarks menu. Hopefully you won't need it very often, or perhaps ever again.

Then switch back to the evil page and click the Escape button.

What the script does:

(1) Set various event handlers to null to deactivate them.

(2) Replace the <head> and <body> of the document to remove whatever was there.

more options

@jscher2000

Wow! That bookmarklet script worked great! I just encountered one of those malicious pages myself. I've run into them before, but none as aggressive as this one. Funny thing is, it matched your example page to the TEE. Word for word even. In the past, I've always been able to escape from those pages just by being quick enough with the alt-F4, but this one left no room to squeeze it in. I decided to google for an answer, and found this thread. Followed the link you provided, added your bookmarklet, and it worked like magic! Big +1!

more options

I have this problem occasionally (like when the idiots that run a site write it into the page for some stupid reason)

The only way I've been able to overcome it so far is to hace session manager installed (it's an add-on) and use cntrl-alt-delete to kill Firefox and then un-check the OFFENDING page when the dialog comes up to recover the browsing session.

more options

The escape bookmarklet worked great.

I Bookmarked the page and that particular bookmark (Escape) and put it in the section under "Recently Bookmarked" so it will be handy.

I had actually given up on bookmarklets since some sites had made it so the bookmarklet that forced pages to remember passwords quit working... I've actually been using a password manager add-on for that (Saved password editor) and adding them in manually so they automatically work on pages as before.