Zoeken in Support

Vermijd ondersteuningsscams. We zullen u nooit vragen een telefoonnummer te bellen, er een sms naar te sturen of persoonlijke gegevens te delen. Meld verdachte activiteit met de optie ‘Misbruik melden’.

Learn More

Deze conversatie is gearchiveerd. Stel een nieuwe vraag als u hulp nodig hebt.

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 antwoord
  • 1 heeft dit probleem
  • 7 weergaven
  • Laatste antwoord van 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?

Alle antwoorden (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.