GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing en.wikipedia.org — Web Messaging - Wikipedia Web Messaging, or cross-document messaging, is an API introduced in the WHATWG HTML5 draft specification, allowing documents to communicate with one another across different origins, or source domains[1] while rendered in a web browser. Prior to HTML5, web browsers disallowed cross-site scripting, to protect against security attacks. This practice barred communication between non-hostile pages as well, making document interaction of any kind difficult.[1][2] Cross-document messaging allows scripts to interact across these boundaries, while providing a rudimentary level of security. Requirements and attributesUsing the Messaging API's
The message
ExampleConsider we want document A loaded from var o = document.getElementsByTagName('iframe')[0]; o.contentWindow.postMessage('Hello B', 'http://example.com/'); The origin of our function receiver(event) { if (event.origin == 'http://example.net') { if (event.data == 'Hello B') { event.source.postMessage('Hello A, how are you?', event.origin); } else { alert(event.data); } } } window.addEventListener('message', receiver, false); An event listener is set up to receive messages from document A. Using the SecurityPoor origin checking can pose a risk for applications which employ cross-document messaging.[5] To safeguard against malicious code from foreign domains, authors should check the SupportSupport for cross-document messaging exists in current versions of Internet Explorer, Mozilla Firefox, Safari, Google Chrome, Opera, Opera Mini, Opera Mobile, and Android web browser.[6] Support for the API exists in the Trident, Gecko, WebKit and Presto layout engines.[7] See alsoReferences
External links
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |