locked
Whitelisting all websites to use window.external.notify RRS feed

  • Question

  • I would like my metro app to be able to display javascript alert popups that are triggered from the webview. With windows 8, the way to do this was using window.external.notify. So I had injected javascript to override the window.alert function and then called window.external.notify.

    However with Windows 8.1 WebView, AllowedScriptNotifyUri and AnyScriptNotifyUri are deprecated. Which means I am not able to set any website to use window.external.notify. I am only able to whitelist specific domains for window.external.notify. Is there way to whitelist all websites all together instead of whitelisting specific domains?


    • Edited by Ryan.dn Monday, December 16, 2013 4:56 PM
    Monday, December 16, 2013 4:55 PM

Answers

  • Sorry, there's not a way to do this.

    http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/17/what-s-new-in-webview-in-windows-8-1.aspx

    Script notify changes in XAML

    To improve the security of WebView, we’ve restricted when window.external.notify() can be used from WebView content. These restrictions prevent untrusted content, or content that has been tampered with, from sending messages that are executed without validation to the host. For content to be able to send notifications the following conditions apply: 

    • The source of the page should be from the local system via NavigateToString(), NavigateToStream() or ms-appx-web:///

    Or 

    • The source of the page is delivered via https:// and the site domain name is listed in the app content URI’s section of the package manifest.

    As part of this change, AllowedScriptNotifyUris and AnyScriptNotifyUri are deprecated and will return errors in Windows 8.1 apps.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 17, 2013 6:17 PM
    Moderator

All replies

  • I'm going to look into this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, December 16, 2013 5:11 PM
    Moderator
  • Thanks for looking into it Matt.
    Tuesday, December 17, 2013 4:25 PM
  • Sorry, there's not a way to do this.

    http://blogs.windows.com/windows/b/appbuilder/archive/2013/07/17/what-s-new-in-webview-in-windows-8-1.aspx

    Script notify changes in XAML

    To improve the security of WebView, we’ve restricted when window.external.notify() can be used from WebView content. These restrictions prevent untrusted content, or content that has been tampered with, from sending messages that are executed without validation to the host. For content to be able to send notifications the following conditions apply: 

    • The source of the page should be from the local system via NavigateToString(), NavigateToStream() or ms-appx-web:///

    Or 

    • The source of the page is delivered via https:// and the site domain name is listed in the app content URI’s section of the package manifest.

    As part of this change, AllowedScriptNotifyUris and AnyScriptNotifyUri are deprecated and will return errors in Windows 8.1 apps.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, December 17, 2013 6:17 PM
    Moderator