Javascript window.open() function opens link without popup blocker

前端 未结 3 1196
离开以前
离开以前 2021-01-20 06:07

Javascript window.open() function opens link without popup blocker, I want to open some links from javascript window.open() function but it get blo

相关标签:
3条回答
  • 2021-01-20 06:46

    Just found the answer from a different thread, thought I shared this one with you guys, the ONLY way to bypass the popup blocker is through the onclick event, the problem I was having was that I had onmousedown instead, I just simply changed it to onclick, and boom! worked instantly!

    0 讨论(0)
  • You can't force it to open a new tab. The functionality is controlled by the browser entirely.

    To avoid having your windows blocked, have the window open on any user event (like onclick).

    0 讨论(0)
  • 2021-01-20 06:57

    You should launch you function from user event. i.e: onclick or href:

     <a href="javascript:window.open('http://google.com');return false;"> open 2 </a>
    
    0 讨论(0)
提交回复
热议问题