Bypassing popup blocker in safari

拥有回忆 提交于 2021-01-29 05:24:11

问题


I have the following HTML

<a href = "#" class="fb">Facebook</a>

I have an onclick even handler that when the link above is clicked, calls window.open. That works in Chrome but not in Safari. How do I get it to work in Safari?

$('fb').on('click', function () {
   window.open();
});

Thanks


回答1:


If the user has pop-ups blocked, there will be no way to "bypass" this. Given your code, try

<a href="#" class="fb" target="_blank">Facebook</a>

instead, for setting the target should also open the link in a new window/tab.



来源:https://stackoverflow.com/questions/38018260/bypassing-popup-blocker-in-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!