惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - leonbao

Unity3D - 关于Dynamic和Static Cocos2d-x——支持多触点 Cocos2d-x——Cocos2d-x 屏幕适配总结 Cocos2d-x——Cocos2d-x 屏幕适配新解 – 兼容与扩展【转载】 Cocos2d-x——Cocos2d-x 屏幕适配新解【转载】 Unity3D-Baked Lightmapping 示例学习 Cocos2d-x——CocosBuilder官方帮助文档翻译3 动画 Cocos2d-x——CocosBuilder官方帮助文档翻译2 多分辨率支持 Cocos2d-x——pthread的使用注意事项 人工智能-有限状态机(FSM)的学习 Cocos2d-x——CocosBuilder官方帮助文档翻译1 使用自定义类 高性能服务器-关于游戏服务器中多线程的使用 Unity3D-UnityVS的安装和使用 高性能服务器-多线程的再次学习 Programming Windows Workflow Foundation第六章-工作流宿主翻译完成 关于SQL Server数据库设计的感悟,请指教 关于分层结构的感悟,请指教 NHibernate 连接 Access数据库的配置文件 - leonbao [原创]关于多层设计想到的问题-涉及Nhibernate和Log4Net
HTML5 - HTML5 postMessage API 注意事项
leonbao · 2013-09-09 · via 博客园 - leonbao

一:发送

window.postMessage("Hello, world", "http://127.0.0.1:8080");

注意,必须要加上http://,后面的端口如果是80的话,不必写,就算写了,监听的时候e.origin也不必把端口带上

二:绑定监听事件

window.addEventListener("message", messageHandler, true);

注意,绑定事件的类型是message,而不是load

三:监听

function messageHandler(e){

  switch(e.origin){

    case "http://127.0.0.1:8080":