ScriptNotfiy never fired


  • Hi,

    I have a webview with a local http server and I am loading an html file with the following content :

    <!DOCTYPE html>
            function myFunction() {
                document.getElementById("demo").innerHTML = "Hello World";
        <p>Click the button to trigger a function.</p>
        <button onclick="myFunction()">Click me</button>
        <p id="demo"></p>
    public WebBasedView()
                _objViewModel = new WebBasedViewModel();
                this.DataContext = _objViewModel;
                _objViewModel.NavigationHelper = new NavigationHelper(this);
                _objViewModel.NavigationHelper.LoadState += navigationHelper_LoadState;
                _objViewModel.NavigationHelper.SaveState += navigationHelper_SaveState;
                webView.NavigationCompleted += webView_NavigationCompleted;
                webView.NavigationStarting += webView_NavigationStarting;
                webView.ScriptNotify += webView_ScriptNotify;
    protected async override void OnNavigatedTo(NavigationEventArgs e)
                BookDataItem bdi = (BookDataItem)e.Parameter;
                _objViewModel.Container = bdi.Container;
                if (_objViewModel.Container != null)
                    _objViewModel.Package = bdi.Package;
                    _objViewModel.Package2 = bdi.Package2;
                    mServer = new EpubServer(this, _objViewModel.Package, _objViewModel.Package2);
                    await mServer.Start();
                    webView.Navigate(new Uri(string.Format("{0}/{1}", mServer.Port, HTTP_READER_URI)));

    void webView_ScriptNotify(object sender, NotifyEventArgs e)

    However I don't receive the ScriptNotify event.

    Any idea why ?

    • Edited by Vincent Rich Tuesday, February 11, 2014 3:58 PM a
    Tuesday, February 11, 2014 3:51 PM


All replies

  • Is your page registered in your ApplicationContentUriRules?

    See the remarks in the ScriptNotify event documentation.

    Also consider that local loopback connections are blocked for production code. Visual Studio enables them for debugging, but that connection should fail outside of VS.


    Tuesday, February 11, 2014 3:58 PM
  • Argh you are kidding right ?

    And I cannot add a http ApplicationContentUriRules we have to declare a https ...

    You mean I cannot use a local http server(based on a StreamSocketListener) listening on in a Windows Store app ?

    Tuesday, February 11, 2014 4:26 PM
  • Correct. You cannot make a local network connection to a process outside of your app package (you can loop back to your own package).


    Friday, February 14, 2014 10:56 PM