问题
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