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

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

©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/

posted @ 2020-07-31 10:06  蕃薯耀  阅读(819)  评论(1编辑  收藏  举报