Home > Web Front-end > H5 Tutorial > A closer look at cross-document messaging in HTML5

A closer look at cross-document messaging in HTML5

黄舟
Release: 2017-03-25 16:13:07
Original
1564 people have browsed it

Cross-document messaging (cross-document messaging), sometimes referred to as XDM, refers to the transmission of messages between pages from different domains. For example, a page in the www.w3cmm.com domain communicates with a page in the p2p.w3cmm.com domain located in an inline frame. Before the emergence of the XDM mechanism, it took a lot of effort to implement this kind of communication more reliably. XDM standardizes this mechanism, allowing us to implement cross-document communication securely and simply.

The core of XDM is the postMessage() method. In the HTML5 specification, other parts besides the XDM part will also mention this method name, but they are all for the same purpose: passing data to another place. For XDM, "another place" refers to the