首页 > Web开发 > 详细

node-webkit 主页面和 iframe 页通讯

时间:2014-05-08 13:58:15      阅读:761      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
<html lang="en-US">
<head>
<title>Hello World!</title>
<style>
</style>
</head>
<body>
<iframe src="http://rwdev.meilishuo.com/test/im" id="f"></iframe>
<script >
var win = document.getElementById(f).contentWindow

var fs = require(fs)

win.onload = function(){
    var t = fs.statSync(./)
    win.postMessage(t,win.location.href)
}
win.addEventListener(message, function(event){
    console.log(parent receive : ,event.data)

    }, false)
</script>
</body>
</html>
bubuko.com,布布扣

 

 

bubuko.com,布布扣
<html lang="en-US">
<head>
</head>
<body>
 
<script >
window.postMessage(t,window.location)
window.addEventListener("message", function(event){
    console.log(child receive ,event.data)
    document.body.innerHTML += <pre>+ JSON.stringify(event.data) + </pre>
    }, false);
</script>
</body>
</html>
bubuko.com,布布扣

 

node-webkit 主页面和 iframe 页通讯,布布扣,bubuko.com

node-webkit 主页面和 iframe 页通讯

原文:http://www.cnblogs.com/vaal-water/p/3713934.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!