locked
Help related with the fact i cannot use AllowedScriptNotifyUris in a webview

    Question

  • Hello I have an app in Windows 8.0 that uses a WebView control and we need to interact with a webview, in some place of the app I have something like it:

    webView.ScriptNotify += NavigatingScriptNotify;

    webView.LoadCompleted += WireUpNavigating;

    and then i have it:

    private void WireUpNavigating(object sender, NavigationEventArgs e)
           {
               string text = "(function(){ function navigating(){  window.external.notify('%%' + location.href);} window.onbeforeunload=navigating;return location.href;})();";
               string uriString = this.WebView.InvokeScript("eval", new string[]
               {
                   text
               });
               
               this.WebView.AllowedScriptNotifyUris = (new Uri[]
               {
                   new Uri(uriString)
               });
           }

    I know that in Windows 8.1 I cannot use it, and I need to get a solution for it.

    In my Windows 8.1 app, in manifest I add the url

    http://myurl/file.pdf

    but because I need to set a a https I changed it for

    https://myurl/file.pdf ( I think that I cannot do this )

    but in Windows 8.0 app when the code runs

    WireUpNavigating 
    is called the value of the
    uriString

    is something like

    http://myurl/file.pdf/showsomething?param2=x&param2=y

    hummm I am confuse with it and don´t know what I need to do for have the same behavior in Windows 8.1 :/

    The app interacts with a pdf file that is showed in webview and i can set some fields and others tasks.

    Thanks

    Sara Silva


    Sara Silva - Microsoft Visual C# MVP
    My blog | My Windows 8 Store Apps Samples | More Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24 | My Snake
    My Windows Phone Apps



    • Edited by smsilvaMVP Wednesday, June 11, 2014 5:56 PM
    Wednesday, June 11, 2014 5:49 PM

Answers

All replies

  • Hi Sara - I am really confused... why/how would a PDF file call window.external.notify?

    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.

    Wednesday, June 11, 2014 6:28 PM
    Moderator
  • I know is strange, but I have a webview that shows the pdf using a url, and it has some features for when I click in specific place in pdf the notify is fired and it allow me to open a popup using xaml, i get the signature and then it is added to the pdf, maybe there are more... the code is not my, is my work to upgrate it to Windows 8.1.

    Like i said i set in Content Uris, in manifest, the url using https but when I navigate to the url I think it will have more parameters, I did not understood all. but is the idea i have. (when i navigate i used the http url)

    The strange is, i set all breakpoints in all methods used in the process, after showing the file in webview in Windows 8.0 I can debug step by step in each method called, but in Windows 8.1 not....the code is a clone (names and files are equal) only the type of the project are different.


    Sara Silva - Microsoft Visual C# MVP
    My blog | My Windows 8 Store Apps Samples | More Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24 | My Snake
    My Windows Phone Apps

    Wednesday, June 11, 2014 8:33 PM
  • just know why the breakpoint not works in windows 8.1 version, it show the web popup and not the xaml control. Not good for me.

    I need to use the xaml popup because it uses the ink and others classes, for get the velocity and pressure of the signature.


    Sara Silva - Microsoft Visual C# MVP
    My blog | My Windows 8 Store Apps Samples | More Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24 | My Snake
    My Windows Phone Apps

    Wednesday, June 11, 2014 8:45 PM
  • The problem is solved:

    1º created a url using https

    2º installed the certificates self sign

    3º add capabilties

    4º add the url to the content uris


    Sara Silva - Microsoft Visual C# MVP
    My blog | My Windows 8 Store Apps Samples | More Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24 | My Snake
    My Windows Phone Apps

    • Marked as answer by smsilvaMVP Thursday, June 19, 2014 3:01 PM
    Thursday, June 19, 2014 3:01 PM