https://blog.csdn.net/qq_33475629/article/details/124930194
我主要是针对跨域的问题:
html端
var highContrastMode = EsdToolbar.storage.getCookie("highContrastMode_assist");
var iframe = document.getElementById('iframe');
try {
iframe.contentWindow.postMessage({
type: highContrastMode,//发送参数
data: 'colorchange'//带上标识
}, '*');
console.log("点击变色")
} catch(e){
window.close();
}
内嵌的iframe
window.addEventListener('message', function (e) {
console.log("收到变色"+e.data.type)
console.log(e.data.data)
},false);
initCookie();
});