Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use <a href="http://msdn.microsoft.com/en-us/library/cc197015%28v=VS.85%29.aspx" rel="nofollow">PostMessage</a> that your main page will receive the message.</p> <p>Here is working example in Win8 Developer Preview:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;meta name="viewport" content="width=1024, height=768" /&gt; &lt;title&gt;WinWebApp1&lt;/title&gt; &lt;!-- WinJS references --&gt; &lt;link rel="stylesheet" href="/winjs/css/ui-dark.css" /&gt; &lt;script src="/winjs/js/base.js"&gt;&lt;/script&gt; &lt;script src="/winjs/js/wwaapp.js"&gt;&lt;/script&gt; &lt;script src="/winjs/js/ui.js"&gt;&lt;/script&gt; &lt;!-- WinWebApp3 references --&gt; &lt;link rel="stylesheet" href="/css/default.css" /&gt; &lt;script src="/js/default.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; window.attachEvent("onmessage", receiveMessage); function receiveMessage(e) { if (e.origin == "http://www.scrumpt.com") document.getElementById("target-element-id").innerHTML = e.data; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe src="http://www.scrumpt.com/frametest2.html" style="display: block; width: 699px; height: 296.95px; left: -499px; top: 0px;"&gt;&lt;/iframe&gt; &lt;div data-win-control="WinJS.UI.ViewBox" style="display: block; top: 50%;"&gt; &lt;div class="fixed-layout"&gt; &lt;div id="target-element-id"&gt;Click on Send Message above&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>On the server (it is live at this moment on <a href="http://www.scrumpt.com/frametest2.html" rel="nofollow">http://www.scrumpt.com/frametest2.html</a>) you have:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function send() { parent.postMessage('hello world', '*'); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a href="javascript:send()"&gt;Send message&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>make sure that your div ("target-element-id") has the correct id when if you copy paste the code above. VS might change the id to "Div1" when pasting.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload