检测窗口是否打开jQuery PHP

检测窗口是否打开jQuery PHP,php,jquery,Php,Jquery,假设我有一份包含以下内容的菜单 因此,这个jQuery和HTML一起为chat.php 如果chat.php窗口当前处于打开状态,以及何时也关闭,是否有方法检测我网站的其余部分 原因是聊天在网站的每一页上,当使用打开到一个新窗口时,我想从活动网页中删除聊天这是我检查窗口是否被打开/阻止的方式 var url = $(this).val(); var win = window.open(url); /* Detectar posible bloqueo de popups */ if (win

假设我有一份包含以下内容的菜单

因此,这个jQuery和HTML一起为
chat.php

如果
chat.php
窗口当前处于打开状态,以及何时也关闭,是否有方法检测我网站的其余部分


原因是聊天在网站的每一页上,当使用打开到一个新窗口时,我想从活动网页中删除聊天

这是我检查窗口是否被打开/阻止的方式

var url = $(this).val();
var win  = window.open(url);
/* Detectar posible bloqueo de popups */
if (win == null || typeof(win) == "undefined" || (win == null && win.outerWidth == 0) || (win != null && win.outerHeight == 0) || win.test == "undefined"){
                    window.location.href = url;
}else if (win){
    win.onload = function(){
    if (win.screenX === 0) {
            win.close();
    }
   };
}

您是否无法使用onload/onunload事件?
var url = $(this).val();
var win  = window.open(url);
/* Detectar posible bloqueo de popups */
if (win == null || typeof(win) == "undefined" || (win == null && win.outerWidth == 0) || (win != null && win.outerHeight == 0) || win.test == "undefined"){
                    window.location.href = url;
}else if (win){
    win.onload = function(){
    if (win.screenX === 0) {
            win.close();
    }
   };
}