zoukankan      html  css  js  c++  java
  • html5 xdm 页面之间的通信

    <!-- 这个是父页面xdm.html -->
    <!
    DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>XDM通信</title> </head> <body> <iframe id="iframeId" src="http://127.0.0.1:8020/avalon/iframe.html" width="100%" height="600px"></iframe> <script type="text/javascript"> window.addEventListener('load' , function(){ var iframeWindow = document.getElementById('iframeId').contentWindow; iframeWindow.postMessage("滚犊子" , "http://127.0.0.1:8020/avalon/iframe.html"); }); </script> </body> </html>
    <!-- 这个是子页面,iframe.html -->
    <!
    DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body onload="aaaa()"> <script type="text/javascript"> function aaaa(){ window.addEventListener('message' , function(event){ console.log(event); alert(event.data); },false) } </script> </body> </html>
  • 相关阅读:
    SpringMVC中的适配器
    JVM的理解
    设计模式 特点比较
    AOP代理模式
    Spring配置补充
    MayBatis与Spring的整合
    增强和注解
    注入
    Mybatis的执行过程
    k8s认证与授权
  • 原文地址:https://www.cnblogs.com/xudy/p/6057016.html
Copyright © 2011-2022 走看看