locked
Not able to Load External Url in iFrame for Windows 8.1

    Question

  • I am not able to load external url in iframe using Windows 8.1 app. I am migrating my windows 8 app to windows 8.1.

    In Windows 8 i was able to load external url very easy in iframe, but its was not happening in windows 8.1.

    Showing Error :

    An iframe attempted to navigate to a URI that is not included in the ApplicationContentUriRules for this app. Use a 
    x-ms-webview element to view the URI instead, or add the URI to the ApplicationContentUriRules section of the package 
    manifest so that the iframe can navigate to it. (In Visual Studio, add this URI to the Content URIs tab of the Manifest 
    Designer.)

    I am not using WebView in current situation but i want to load in Url in iframe.

    Please suggest on this.


    shishir

    Wednesday, November 13, 2013 2:57 PM

Answers

  • For Windows 8.1, the allowable uses of iframe became more restricted because of the availability of the x-ms-Webview element. Put simply, using a remote URI with an iframe requires https:// and requires that the URI is listed in the Content Uri rules section of the manifest.

    When migrating to Windows 8.1, you should use the x-ms-webview control in place of an iframe in most cases. It's generally as simple as replacing <iframe src=...> with <x-ms-webview src=...> in your markup. If you have postMessage communication with the iframe in Win8, however, you'll need to convert that code to use the webview's invokeScriptAsync (to call functions in the webview) and use window.external.notify to raise events back to the app.

    I go into detail of all this in Chapter 4 of my second edition book (free from MSPress). You can also refer to the Webview sample in the 8.1 SDK. You can also refer to the 8.1 Developer's Guide section on Webview.

    Kraig

    Author, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, a free ebook from Microsoft Press. First edition (for Windows 8) also available.


    Wednesday, November 13, 2013 4:51 PM