如何检查是否允许在客户端浏览器中显示弹出窗口?
How can I check whether or not pop-ups are allowed to show in client's browser?
作为对某些操作的响应,我向用户显示了一个弹出窗口,并且我希望能够通知用户如果) 他已禁止在此页面上弹出窗口。
您可以执行以下操作
var windowName = 'userConsole';
var popUp = window.open('/popup-page.php', windowName, 'width=1000, height=700, left=24, top=24, scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
alert('Please disable your pop-up blocker and click the "Open" link again.');
}
else {
popUp.focus();
}
作为对某些操作的响应,我向用户显示了一个弹出窗口,并且我希望能够通知用户如果) 他已禁止在此页面上弹出窗口。
您可以执行以下操作
var windowName = 'userConsole';
var popUp = window.open('/popup-page.php', windowName, 'width=1000, height=700, left=24, top=24, scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
alert('Please disable your pop-up blocker and click the "Open" link again.');
}
else {
popUp.focus();
}