这是我需要的:我在浏览器中打开了一个 index.html。我打开一个新窗口,例如 caller.html。当 caller.html 加载时,它会向 index.html 发送一条消息。
我怎么能用 html5 做到这一点?我在考虑 Sharedworkers 或 Postmessage,但我没有找到可以轻松实现此功能的演示或示例代码。
我不需要跨浏览器和后备解决方案。
这是我需要的:我在浏览器中打开了一个 index.html。我打开一个新窗口,例如 caller.html。当 caller.html 加载时,它会向 index.html 发送一条消息。
我怎么能用 html5 做到这一点?我在考虑 Sharedworkers 或 Postmessage,但我没有找到可以轻松实现此功能的演示或示例代码。
我不需要跨浏览器和后备解决方案。
MDN 有很好的文档和示例:https ://developer.mozilla.org/en/DOM/window.postMessage