iframe可经过postMessage解决跨域、跨窗口消息传递

http://www.javashuo.com/article/p-uyfsofag-dg.htmljavascript

跨域微信分享https://blog.csdn.net/hsdllcw/article/details/79326189html

1 //iframe传参给父级页面
2 function give_info(){
3     console.log("触发事件");
4     window.parent.postMessage(1,'*');
5 }
//接收值window.addEventListener('message',function(e){
            var color=e.data;
            document.getElementById('color').style.backgroundColor=color;
},false);
相关文章
相关标签/搜索