locked
Loading html page in iframe from local context

    Question

  • How to load local html page which is in local folder of my app into iframe? I don't want to use webview.

    And I am pretty sure that the local page is not harmful to app. So I am intentionally willing to load it in Iframe with some js reference.

    All the content is safe and secure.


    Monday, June 2, 2014 11:26 AM

Answers

  • I'm wondering why the first Webview is really necessary. Would it be possible, for example, to load wrapper.html/.js as an HTML fragment, meaning that you load it into a div in your main page and then use a Webview for page.html/.js? You can use WinJS.UI.Pages API for this or the lower-level WinJS.UI.Fragments API. This depends on wrapper.html being in your app package, but it sounds like that's a fixed piece of code rather than something that's dynamically generated or downloaded like page.html might be.
    Tuesday, June 3, 2014 3:59 PM

All replies

  • Local content isn't supported with the iframe, which was one of the big reasons that the x-ms-webview element was added. What is blocking you from using webview?

    Kraig

    Author, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, a free ebook from Microsoft Press.


    Monday, June 2, 2014 4:01 PM
  • I have Webview in which I am opening my app page which has some wrapper js class. inside webview I need to open html page which I have placed in App local folder, ultimately its javascript uses wrapper methods defined in webview page.

    App--> webview ( wrapper.html , wrapper.js ) --> iframe ( page.html , page.js )

    page.js will invoke method from wrapper.js , wrapper.js will do scriptnotify and get some data and return back to page.js.

    tragedy is that I am strictly not allowed to change anything in my page.html and page.js ..

                                                                           

     
    Tuesday, June 3, 2014 4:48 AM
  • I'm wondering why the first Webview is really necessary. Would it be possible, for example, to load wrapper.html/.js as an HTML fragment, meaning that you load it into a div in your main page and then use a Webview for page.html/.js? You can use WinJS.UI.Pages API for this or the lower-level WinJS.UI.Fragments API. This depends on wrapper.html being in your app package, but it sounds like that's a fixed piece of code rather than something that's dynamically generated or downloaded like page.html might be.
    Tuesday, June 3, 2014 3:59 PM