Prevent blocked popup to be opened by FirefoxJavaScript open in a new window, not tabHow to prevent buttons from submitting formsTargeting only Firefox with CSS'innerText' works in IE, but not in FirefoxCreating a bookmarklet that doesn't get blockedHow do I manually fire HTTP POST requests with Firefox or Chrome?Open a URL in a new tab (and not a new window) using JavaScriptPopup block under FireFoxtarget=_blank to open a tab, and if failing opening a tab, opens popup with height and widthOpen form submit in new window without popup blocking

What is a "staved" town, like in "Staverton"?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

Find All Entire Functions that Satisfy Some Condition

What kind of curve (or model) should I fit to my percentage data?

RC differentiator giving a higher output amplitude than input amplitude

Can't understand how static works exactly

How can I calculate the cost of Skyss bus tickets

Why is the UH-60 tail rotor canted?

How does mathematics work?

Adding gears to my grandson's 12" bike

What is "ass door"?

How can Kazakhstan perform MITM attacks on all HTTPS traffic?

What is the significance of numbers(2,3) mentioned in SOT23?

Killing a star safely

Are there any English words pronounced with sounds/syllables that aren't part of the spelling?

Cargo capacity of a kayak

how to add 1 milliseconds on a datetime string?

Origin of the suffix in hippocampus

Pass USB 3.0 connection through D-SUB connector

German phrase for 'suited and booted'

Is an easily guessed plot twist a good plot twist?

Recruiter wants to represent me for a role that I've already applied to

Is the apartment I want to rent a scam?

Dedicated to our #1 Fan



Prevent blocked popup to be opened by Firefox


JavaScript open in a new window, not tabHow to prevent buttons from submitting formsTargeting only Firefox with CSS'innerText' works in IE, but not in FirefoxCreating a bookmarklet that doesn't get blockedHow do I manually fire HTTP POST requests with Firefox or Chrome?Open a URL in a new tab (and not a new window) using JavaScriptPopup block under FireFoxtarget=_blank to open a tab, and if failing opening a tab, opens popup with height and widthOpen form submit in new window without popup blocking






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















For a webapp, I have an option to open a popup (w = window.open) to enable multiscreen for enduser.



When the popup is opened by js without user input (loading previous user configuration), Firefox block it as expected.



I can detect it with w == null and handle this to have a functional application without the popup if the user doesn't want them.



However, if the user click the "Allow this site to open popups", then Firefox open a popup containing the current page.



Is there a possibility to prevent Firefox from opening blocked popup ?



Edit: MWE



<html>
<body>
<script type="text/javascript">
function bug ()
let w = window.open('', '', 'width=800, height=600');
if (w == null)
console.log("blocked");
return;

let p = w.document.createElement('div');
p.className += "layout";
let c = w.document.createElement('div');
c.className += "content";
c.style.height = '100%';
c.innerHTML = "Hello world !";
w.document.body.appendChild(p);
p.appendChild(c);


document.body.innerHTML = "Hello fellow human beings";
bug();
</script>
</body>
</html>


Edit2 : The mix of current page and popup was on my side, the main problem still persists.



Thanks










share|improve this question
























  • Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

    – mplungjan
    Mar 26 at 14:25











  • You likely use window.open in a manner that give you that result. Please post your code.

    – mplungjan
    Mar 26 at 14:25

















0















For a webapp, I have an option to open a popup (w = window.open) to enable multiscreen for enduser.



When the popup is opened by js without user input (loading previous user configuration), Firefox block it as expected.



I can detect it with w == null and handle this to have a functional application without the popup if the user doesn't want them.



However, if the user click the "Allow this site to open popups", then Firefox open a popup containing the current page.



Is there a possibility to prevent Firefox from opening blocked popup ?



Edit: MWE



<html>
<body>
<script type="text/javascript">
function bug ()
let w = window.open('', '', 'width=800, height=600');
if (w == null)
console.log("blocked");
return;

let p = w.document.createElement('div');
p.className += "layout";
let c = w.document.createElement('div');
c.className += "content";
c.style.height = '100%';
c.innerHTML = "Hello world !";
w.document.body.appendChild(p);
p.appendChild(c);


document.body.innerHTML = "Hello fellow human beings";
bug();
</script>
</body>
</html>


Edit2 : The mix of current page and popup was on my side, the main problem still persists.



Thanks










share|improve this question
























  • Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

    – mplungjan
    Mar 26 at 14:25











  • You likely use window.open in a manner that give you that result. Please post your code.

    – mplungjan
    Mar 26 at 14:25













0












0








0








For a webapp, I have an option to open a popup (w = window.open) to enable multiscreen for enduser.



When the popup is opened by js without user input (loading previous user configuration), Firefox block it as expected.



I can detect it with w == null and handle this to have a functional application without the popup if the user doesn't want them.



However, if the user click the "Allow this site to open popups", then Firefox open a popup containing the current page.



Is there a possibility to prevent Firefox from opening blocked popup ?



Edit: MWE



<html>
<body>
<script type="text/javascript">
function bug ()
let w = window.open('', '', 'width=800, height=600');
if (w == null)
console.log("blocked");
return;

let p = w.document.createElement('div');
p.className += "layout";
let c = w.document.createElement('div');
c.className += "content";
c.style.height = '100%';
c.innerHTML = "Hello world !";
w.document.body.appendChild(p);
p.appendChild(c);


document.body.innerHTML = "Hello fellow human beings";
bug();
</script>
</body>
</html>


Edit2 : The mix of current page and popup was on my side, the main problem still persists.



Thanks










share|improve this question
















For a webapp, I have an option to open a popup (w = window.open) to enable multiscreen for enduser.



When the popup is opened by js without user input (loading previous user configuration), Firefox block it as expected.



I can detect it with w == null and handle this to have a functional application without the popup if the user doesn't want them.



However, if the user click the "Allow this site to open popups", then Firefox open a popup containing the current page.



Is there a possibility to prevent Firefox from opening blocked popup ?



Edit: MWE



<html>
<body>
<script type="text/javascript">
function bug ()
let w = window.open('', '', 'width=800, height=600');
if (w == null)
console.log("blocked");
return;

let p = w.document.createElement('div');
p.className += "layout";
let c = w.document.createElement('div');
c.className += "content";
c.style.height = '100%';
c.innerHTML = "Hello world !";
w.document.body.appendChild(p);
p.appendChild(c);


document.body.innerHTML = "Hello fellow human beings";
bug();
</script>
</body>
</html>


Edit2 : The mix of current page and popup was on my side, the main problem still persists.



Thanks







javascript firefox popup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 15:00







elnabo

















asked Mar 26 at 14:08









elnaboelnabo

1731 silver badge9 bronze badges




1731 silver badge9 bronze badges












  • Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

    – mplungjan
    Mar 26 at 14:25











  • You likely use window.open in a manner that give you that result. Please post your code.

    – mplungjan
    Mar 26 at 14:25

















  • Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

    – mplungjan
    Mar 26 at 14:25











  • You likely use window.open in a manner that give you that result. Please post your code.

    – mplungjan
    Mar 26 at 14:25
















Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

– mplungjan
Mar 26 at 14:25





Please visit the help center, take the tour to see what and How to Ask. Do some research, search for related topics on SO; if you get stuck, post a minimal reproducible example of your attempt, noting input and expected output.

– mplungjan
Mar 26 at 14:25













You likely use window.open in a manner that give you that result. Please post your code.

– mplungjan
Mar 26 at 14:25





You likely use window.open in a manner that give you that result. Please post your code.

– mplungjan
Mar 26 at 14:25












1 Answer
1






active

oldest

votes


















1














If the user chooses to open the popup from the popup blocked toolbar after it has been blocked, it will load the URL you give to window.open. You haven't given one, so it'll the default to the same page.



First, and the usual, solution is to have the popup load a different page instead of letting it load the same page and then trying to modify it's DOM. Then opening the blocked popup after the fact will still load the correct page with different content.



Second solution to do more closely what you asked for, is to set the popup URL to a page which will just close itself immediately. In the good case of not getting blocked you can stop the loading of that page before it loads to close itself.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359197%2fprevent-blocked-popup-to-be-opened-by-firefox%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If the user chooses to open the popup from the popup blocked toolbar after it has been blocked, it will load the URL you give to window.open. You haven't given one, so it'll the default to the same page.



    First, and the usual, solution is to have the popup load a different page instead of letting it load the same page and then trying to modify it's DOM. Then opening the blocked popup after the fact will still load the correct page with different content.



    Second solution to do more closely what you asked for, is to set the popup URL to a page which will just close itself immediately. In the good case of not getting blocked you can stop the loading of that page before it loads to close itself.






    share|improve this answer



























      1














      If the user chooses to open the popup from the popup blocked toolbar after it has been blocked, it will load the URL you give to window.open. You haven't given one, so it'll the default to the same page.



      First, and the usual, solution is to have the popup load a different page instead of letting it load the same page and then trying to modify it's DOM. Then opening the blocked popup after the fact will still load the correct page with different content.



      Second solution to do more closely what you asked for, is to set the popup URL to a page which will just close itself immediately. In the good case of not getting blocked you can stop the loading of that page before it loads to close itself.






      share|improve this answer

























        1












        1








        1







        If the user chooses to open the popup from the popup blocked toolbar after it has been blocked, it will load the URL you give to window.open. You haven't given one, so it'll the default to the same page.



        First, and the usual, solution is to have the popup load a different page instead of letting it load the same page and then trying to modify it's DOM. Then opening the blocked popup after the fact will still load the correct page with different content.



        Second solution to do more closely what you asked for, is to set the popup URL to a page which will just close itself immediately. In the good case of not getting blocked you can stop the loading of that page before it loads to close itself.






        share|improve this answer













        If the user chooses to open the popup from the popup blocked toolbar after it has been blocked, it will load the URL you give to window.open. You haven't given one, so it'll the default to the same page.



        First, and the usual, solution is to have the popup load a different page instead of letting it load the same page and then trying to modify it's DOM. Then opening the blocked popup after the fact will still load the correct page with different content.



        Second solution to do more closely what you asked for, is to set the popup URL to a page which will just close itself immediately. In the good case of not getting blocked you can stop the loading of that page before it loads to close itself.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 15:15









        sim642sim642

        6947 silver badges14 bronze badges




        6947 silver badges14 bronze badges


















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid …


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55359197%2fprevent-blocked-popup-to-be-opened-by-firefox%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

            해남서초등학교 학교 연혁 학교 동문 외부 링크 둘러보기 메뉴북위 34° 34′ 21″ 동경 126° 35′ 50″ / 북위 34.5726385° 동경 126.5972670°  / 34.5726385; 126.5972670해남서초등학교eh