天天看點

判斷頁面是否有父視窗,判斷頁面是否有父頁面

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

©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頁面中");
}      

今天越懶,明天要做的事越多。

繼續閱讀