To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
Languages
Recent
Show all languages
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

From Wikipedia, the free encyclopedia

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.

YouTube Encyclopedic

  • 1/5
    Views:
    1 793
    796
    442
    18 486
    11 311
  • Modernize Your Conversations with Customers Using Messaging for In-App and Web
  • Genesys Cloud Web Messaging and the Future of Digital
  • How to Set Up Messages For Web
  • Text Anyone, Anywhere for Free: Our Top FREE SMS Website Picks!
  • Firebase push notification for web using JavaScript and PHP | Firebase Cloud Messaging

Transcription

Requirements and attributes

Using the Messaging API's postMessage method, plain text messages can be sent from one domain to another, e.g. from a parent document to an IFRAME.[3] This requires that the author first obtain the Window object of the receiving document. As a result, messages can be posted to the following:[2]

  • other frames or iframes within the sender document's window
  • windows the sender document explicitly opens through JavaScript calls
  • the parent window of the sender document
  • the window which opened the sender document

The message event being received has the following attributes:

  • data – The data, or actual content, of the incoming message.
  • origin – The origin of the sender document. This typically includes the scheme, hostname and port. It does not include the path or fragment identifier.[1]
  • source – the WindowProxy of where the document came from (the source window).

postMessage is not a blocking call; messages are processed asynchronously.[4]

Example

Consider we want document A loaded from example.net to communicate with document B loaded from example.com into an iframe or popup window.[1] The JavaScript for document A will look as follows:

var o = document.getElementsByTagName('iframe')[0];
o.contentWindow.postMessage('Hello B', 'http://example.com/');

The origin of our contentWindow object is passed to postMessage. It must match the origin of the document we wish to communicate with (in this case, document B). Otherwise, a security error will be thrown and the script will stop.[3] The JavaScript for document B will look as follows:

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 origin property, it then checks that the domain of the sender is the expected domain. Document B then looks at the message, either displaying it to the user, or responding in turn with a message of its own for document A.[1]

Security

Poor 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 origin attribute to ensure messages are accepted from domains they expect to receive messages from. The format of incoming data should also be checked that it matches the expected format.[1]

Support

Support 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 also

References

  1. ^ a b c d e f Cross-Document Messaging – HTML Draft Standard
  2. ^ a b WebKit DOM Programming Topics - Cross Document Messaging[dead link]
  3. ^ a b Remy, Sharp, Messages, Workers, and Sockets, Introducing HTML5, New Riders, 2011, p. 197-199
  4. ^ "HTML5 Web Messaging".
  5. ^ HTML5 Security in a Nutshell
  6. ^ When can I use Cross-Document Messaging?
  7. ^ A Selection of Supported Features in HTML5[dead link]

External links

This page was last edited on 10 May 2024, at 14:45
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.