<s>
Web	B-General_Concept
Messaging	I-General_Concept
or	O
cross-document	B-General_Concept
messaging	I-General_Concept
,	O
is	O
an	O
API	B-General_Concept
introduced	O
in	O
the	O
WHATWG	B-Language
HTML5	B-Application
draft	O
specification	O
,	O
allowing	O
documents	O
to	O
communicate	O
with	O
one	O
another	O
across	O
different	O
origins	O
,	O
or	O
source	O
domains	O
while	O
rendered	O
in	O
a	O
web	B-Application
browser	I-Application
.	O
</s>
<s>
Prior	O
to	O
HTML5	B-Application
,	O
web	B-Application
browsers	I-Application
disallowed	O
cross-site	O
scripting	O
,	O
to	O
protect	O
against	O
security	O
attacks	O
.	O
</s>
<s>
Cross-document	B-General_Concept
messaging	I-General_Concept
allows	O
scripts	O
to	O
interact	O
across	O
these	O
boundaries	O
,	O
while	O
providing	O
a	O
rudimentary	O
level	O
of	O
security	O
.	O
</s>
<s>
Using	O
the	O
Messaging	O
API	B-General_Concept
's	O
postMessage	B-General_Concept
method	O
,	O
plain	O
text	O
messages	O
can	O
be	O
sent	O
from	O
one	O
domain	O
to	O
another	O
,	O
e.g.	O
</s>
<s>
from	O
a	O
parent	O
document	O
to	O
an	O
IFRAME	B-Algorithm
.	O
</s>
<s>
postMessage	B-General_Concept
is	O
not	O
a	O
blocking	O
call	O
;	O
messages	O
are	O
processed	O
asynchronously	O
.	O
</s>
<s>
Consider	O
we	O
want	O
document	O
A	O
loaded	O
from	O
example.net	O
to	O
communicate	O
with	O
document	O
B	O
loaded	O
from	O
example.com	O
into	O
an	O
iframe	B-Algorithm
or	O
popup	O
window	O
.	O
</s>
<s>
The	O
JavaScript	B-Language
for	O
document	O
A	O
will	O
look	O
as	O
follows	O
:	O
</s>
<s>
The	O
origin	O
of	O
our	O
contentWindow	O
object	O
is	O
passed	O
to	O
postMessage	B-General_Concept
.	O
</s>
<s>
The	O
JavaScript	B-Language
for	O
document	O
B	O
will	O
look	O
as	O
follows	O
:	O
</s>
<s>
Poor	O
origin	O
checking	O
can	O
pose	O
a	O
risk	O
for	O
applications	O
which	O
employ	O
cross-document	B-General_Concept
messaging	I-General_Concept
.	O
</s>
<s>
Support	O
for	O
cross-document	B-General_Concept
messaging	I-General_Concept
exists	O
in	O
current	O
versions	O
of	O
Internet	B-Application
Explorer	I-Application
,	O
Mozilla	B-Application
Firefox	I-Application
,	O
Safari	B-Application
,	O
Google	B-Application
Chrome	I-Application
,	O
Opera	B-Application
,	O
Opera	B-Protocol
Mini	I-Protocol
,	O
Opera	B-Language
Mobile	I-Language
,	O
and	O
Android	B-Application
web	I-Application
browser	I-Application
.	O
</s>
<s>
Support	O
for	O
the	O
API	B-General_Concept
exists	O
in	O
the	O
Trident	B-Application
,	O
Gecko	B-Language
,	O
WebKit	B-Language
and	O
Presto	B-Application
layout	I-Application
engines	I-Application
.	O
</s>
