a标签打开一个新页面 想用postMessage的方式传递些数据 但是一直没有成功
在外面包了一层 定时器就OK了。
求解~~
没有跨域的问题
我在想 新打开的页面是否‘太慢’了 根本没有响应postmessage事件
<code class="language-js"><span class="kd">var</span> <span class="nx">newWin</span> <span class="o">=</span> <span class="p">...</span> <span class="nb">window</span><span class="p">.</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s1">'message'</span><span class="p">,</span> <span class="nx">e</span> <span class="o">=></span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="cm">/* got ready message from demo.html */</span><span class="p">)</span> <span class="p">{</span> <span class="nx">newWin</span><span class="p">.</span><span class="nx">postMessage</span><span class="p">(...)</span> <span class="p">}</span> <span class="p">})</span> </code>