<p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> if <var title="">transfer</var> array contains duplicate objects or if
<var title="">message</var> could not be cloned.</p>
<p>The second and third arguments can be given in either order,
and the <var title="">transfer</var> array can be omitted
entirely.</p>
</dd>
</dl><p class=note>When posting a message to a <code><a href=#window>Window</a></code> of a
<div class=impl>
<p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
follow these steps:</p>
<p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage()</code></dfn>
method (with two or three arguments) on a <code><a href=#window>Window</a></code>
object, the user agent must follow these steps:</p>
<ol><!-- a lot of this is similar or identical to port.postMessage --><li>
<p>Let <var title="">message</var> be the first argument.</p>
</li>
<li>
<p>Let <var title="">targetOrigin</var> be the second argument if
the second argument is a string, or else the third argument.</p>
</li>
<li>
<p>Let <var title="">transfer</var> be the second argument if the
second argument is an array of <code><a href=#transferable>Transferable</a></code> objects,
or else the third argument.</p>
</li>
<li>
<p>If the value of the <var title="">targetOrigin</var> argument
is neither a single U+002A ASTERISK character (*), a single U+002F
SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a>, then
<li>
<p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
<p>If the method was invoked with three arguments, run these
<p>Throws a <code><a href=#datacloneerror>DataCloneError</a></code> if <var title="">transfer</var> array contains duplicate objects or if
<var title="">message</var> could not be cloned.</p>
<p>The second and third arguments can be given in either order,
and the <var title="">transfer</var> array can be omitted
entirely.</p>
</dd>
</dl><p class=note>When posting a message to a <code><a href=#window>Window</a></code> of a
<div class=impl>
<p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage(<var title="">message</var>, <var title="">targetOrigin</var>, <var title="">transfer</var>)</code></dfn> method (with two or three
arguments) on a <code><a href=#window>Window</a></code> object, the user agent must
follow these steps:</p>
<p>When a script invokes the <dfn id=dom-window-postmessage title=dom-window-postMessage><code>postMessage()</code></dfn>
method (with two or three arguments) on a <code><a href=#window>Window</a></code>
object, the user agent must follow these steps:</p>
<ol><!-- a lot of this is similar or identical to port.postMessage --><li>
<p>Let <var title="">message</var> be the first argument.</p>
</li>
<li>
<p>Let <var title="">targetOrigin</var> be the second argument if
the second argument is a string, or else the third argument.</p>
</li>
<li>
<p>Let <var title="">transfer</var> be the second argument if the
second argument is an array of <code><a href=#transferable>Transferable</a></code> objects,
or else the third argument.</p>
</li>
<li>
<p>If the value of the <var title="">targetOrigin</var> argument
is neither a single U+002A ASTERISK character (*), a single U+002F
SOLIDUS character (/), nor an <a href=#absolute-url>absolute URL</a>, then
<li>
<p>If the method was invoked with a third argument <var title="">transfer</var>, run these substeps:</p>
<p>If the method was invoked with three arguments, run these