Is there a way to determine if the current window is a popup? This is what I have right now but for some reason it is not working. I am trying to make sure that certain pages are only shown in popup window.
if(!opener)
window.location = 'error.php';
The value of opener is [object DOMWindow] even though the window is not popup.
Assuming you're opening popup windows yourself- set a flag:
var myWindow = window.open(...);
myWindow.isPopup = true;
then, in your popup window, check for the flag:
if (!window.isPopup) {
window.location = 'error.php';
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.