The pop-up window is very useful when a pop-up window is needed. For programmers who develop such websites, they have a thorny problem. They don't know whether these pop-up windows are blocked by the browser or various browser plug-ins and do not pop up. Of course, the browser will notify the user, but these rarely attract the user's attention. Here's a simple way to test whether your pop-ups are blocked.
The JavaScript
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 unblock the window and click the link again.');
}
else {
popUp.focus();
}
The first step is to pop up the window normally and capture the window handle to check whether this handle object exists. If it exists, thank God. If it does not exist, we prompt the user to turn off pop-up blocking settings and click the link again. Of course, you can prompt users with more convincing information. Or you can use a popup layer to display information.