判断页面是否有父窗口,判断页面是否有父页面

================================

©Copyright 蕃薯耀 2020-07-31

https://www.cnblogs.com/fanshuyao/

 

if(window.location != parent.location){//判断是否有父窗口,当不相等时,表示有父窗口
    console.log("向父页面发送回调请求:tableName = " + tableName + ",layerName = " + layerName);
    window.parent.postMessage(returnObject, "*");

}else{
    console.error("需要嵌套在iframe页面中");
}

 

 

================================

©Copyright 蕃薯耀 2020-07-31

https://www.cnblogs.com/fanshuyao/

你可能感兴趣的:(判断页面是否有父窗口,判断页面是否有父页面)