Mozilla VPN is currently experiencing an outage. Our team is actively working to resolve the issue. Please check the status page for real-time updates. Thank you for your patience.

This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

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

Trying to open a popup when popups are blocked, FF warns and add a button allowing to add an exception. Then it opens the blocked content. How to avoid this?

  • 1 reply
  • 1 has this problem
  • 7 views
  • Last reply by Cássio

more options

My system needs popups not being blocked to work properly. So I test this right after login (bellow follows a simple code):

<script type="text/javascript"> //<![CDATA[ function checkPopupsBlocked() { popupWindow = window.open("testingBlockedPopups.html", "testWindow", "width=300, height=100, toolbar=no, directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no"); try { popupWindow.focus(); } catch (e) { alert("Popups are blocked"); } // it will be null when popups are blocked if (!popupWindow === null && !popupWindow === undefined) { popupWindow.close(); } } //]]> </script>

When popups are blocked, it shows the alert. When I close the alert, FF shows right bellow the address bar a button offering the possibility to add an exception for the current site. If I add the exception, my "testWindow" is automatically opened, which is undesirable (Chrome, for example, doesn't do this). Is there a programatically way to prevent testWindow to be opened in this situation?

My system needs popups not being blocked to work properly. So I test this right after login (bellow follows a simple code): <html> <head> <script type="text/javascript"> //<![CDATA[ function checkPopupsBlocked() { popupWindow = window.open("testingBlockedPopups.html", "testWindow", "width=300, height=100, toolbar=no, directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no"); try { popupWindow.focus(); } catch (e) { alert("Popups are blocked"); } // it will be null when popups are blocked if (!popupWindow === null && !popupWindow === undefined) { popupWindow.close(); } } //]]> </script> </head> <body onload="checkPopupsBlocked();"> </body> </html> When popups are blocked, it shows the alert. When I close the alert, FF shows right bellow the address bar a button offering the possibility to add an exception for the current site. If I add the exception, my "testWindow" is automatically opened, which is undesirable (Chrome, for example, doesn't do this). Is there a programatically way to prevent testWindow to be opened in this situation?

All Replies (1)

more options

Code was removed when posting the original question, so I'm trying again:

function checkPopupsBlocked() { popupWindow = window.open("testingBlockedPopups.html", "testWindow", "width=300, height=100, toolbar=no, directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=no, titlebar=no, toolbar=no");

try { popupWindow.focus(); } catch (e) { alert("Popups are blocked"); }

// it will be null when popups are blocked if (!popupWindow === null && !popupWindow === undefined) { popupWindow.close(); } }

and then I call it on body onload.