window.open with popup blocker

前端 未结 5 2092
别那么骄傲
别那么骄傲 2020-12-19 11:27

I am trying to open a certain page from my default page. All the code there is in the default page is:



        
相关标签:
5条回答
  • 2020-12-19 11:43

    You can open popup using onclick event only. You can try submitting form with target="_blank" and action set to your url, but forefox blocked this, google chrome not.

    0 讨论(0)
  • 2020-12-19 11:47

    You won't be able to do that. Its a user preference to block pop up windows and you have no control over that.

    0 讨论(0)
  • 2020-12-19 11:48

    I don't think that's impossible, everyday I see streaming pages opening popups all the time and mine's being blocked so it should be a way to bypass it

    0 讨论(0)
  • 2020-12-19 11:53

    adamantium is right. a popup blocker would be pretty useless if it could be overridden by the code that's causing the popup. the best you can do is this:

    <script type="text/javascript">
        var myPopup = window.open("StartPage.aspx", "", "fullscreen=yes");  
        if(!myPopup)
            alert('a popup was blocked. please make an exception for this site in your popup blocker and try again');
    </script>
    
    0 讨论(0)
  • 2020-12-19 11:59

    As others have stated, you simply can't. The browser is blocking that behavior. Another option would be to not use window.open but instead use a javascript component which can give you the same behavior.

    0 讨论(0)
提交回复
热议问题