locked
windows 8 app: how to get or modify iframe's content RRS feed

  • Question

  • in IE's html , the below code can work, but it doesn't work in Win8's html/Css app.

      myIFrame.contentWindow.document.body.innerHTML = content;

    can anyone share the code about how to get or modify iframe's content in win8 app?

    thanks,

    chh

    Thursday, November 15, 2012 8:45 PM

Answers

  • The HTML5 postMessage function can be used to communicate between an iframe and its containing parent across contexts.

    This can be useful to execute remote script within the web context and pass the results to the local context; script acquired in the web context should not be itself passed to the local context and executed there. (Windows Store policy actually disallows this, and apps submitted to the Store will be analyzed for such practices.)

    -S


    http://zSprawl.com

    • Marked as answer by chh-CFrim Saturday, November 17, 2012 7:25 AM
    Friday, November 16, 2012 1:52 AM

All replies

  • The HTML5 postMessage function can be used to communicate between an iframe and its containing parent across contexts.

    This can be useful to execute remote script within the web context and pass the results to the local context; script acquired in the web context should not be itself passed to the local context and executed there. (Windows Store policy actually disallows this, and apps submitted to the Store will be analyzed for such practices.)

    -S


    http://zSprawl.com

    • Marked as answer by chh-CFrim Saturday, November 17, 2012 7:25 AM
    Friday, November 16, 2012 1:52 AM
  • thanks.

    however, I can't use postMessage to iframe other website's page and get its content. Now I don't think html5/JS application can do that, I will try using win8 c# app.

    Saturday, November 17, 2012 7:28 AM