locked
Call C# methods from Javascript in WebView with HTTP uri in Windows 8.1

    Question

  • I have a C# metro application on Windows 8.1 with a webview pointing to a my server application on a HTTP url. I need to call back into the C# application from the Javascript code in the webview.

    I tried to use WebView.ScriptNotify and to call window.external.notify

    This works on Windows 8 but apparently, in Windows 8.1, the documentation states that the URI in the WebView calling window.external.notify must use HTTPS but my application has a HTTP uri.

    Is there a way to call the C# code from the Javascript in the webview other than using window.external.notify?

    If not, is there a way to use HTTP uris with window.external.notify in Windows 8.1?


    Wednesday, May 21, 2014 7:34 AM

Answers

  • The site must be included in the ApplicationContentUriRules and must use HTTPS.

    There isn't a way around this for content hosted on the web. It doesn't apply to content from the app package, loaded using ms-local-stream: or via NavigateToString, so depending on the actual data you may be able to download it, confirm that it's safe, and then load it locally.

    --Rob

    Wednesday, May 21, 2014 10:18 PM
    Owner

All replies

  • The site must be included in the ApplicationContentUriRules and must use HTTPS.

    There isn't a way around this for content hosted on the web. It doesn't apply to content from the app package, loaded using ms-local-stream: or via NavigateToString, so depending on the actual data you may be able to download it, confirm that it's safe, and then load it locally.

    --Rob

    Wednesday, May 21, 2014 10:18 PM
    Owner
  • Thank you for your reply.

    I believe Microsoft should have left developers decide whether they want to use HTTP or HTTPS for their URIs (like in Windows 8).

    If anything bad happens, it should be the developer's responsibility, not Microsoft's.

    Thursday, May 22, 2014 7:28 AM