locked
WebView exception " navCancelInit is undefined" RRS feed

  • Question

  • Hi

    I am trying to navigate to an website (localy hosted on IIS ) in and  webview control. after loading of homepage (login.aspx)  and successful login it redirects to onother page (userspage.aspx), but as soon as I click on login button it throws an exception "navCancelInit is undefined".

    How can I solve this problem ?

    please help asap.


    Tuesday, December 10, 2013 7:43 AM

Answers

  • You still didn't answer the question.  This doesn't sound like an exception from the app itself, but more that the web page you're displaying is throwing a javascript error.  You need to fix the webpage.

    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, December 11, 2013 12:56 PM
    Moderator

All replies

  • Is the exception thrown by the store app or does it occur within the webview?


    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 10, 2013 1:25 PM
    Moderator
  • string username = "xxxxxx";
    string password = "yyyyyy";
    var handler = new HttpClientHandler();
    handler.Credentials = new NetworkCredential(username, password);

    HttpClient httpClient = new HttpClient(handler);

    //HttpClient httpClient = new HttpClient();

    HttpResponseMessage response = await httpClient.GetAsync("http://localhost:9090/");

    System.Diagnostics.Debug.WriteLine("response: " + response);
    string responseAsString = await response.Content.ReadAsStringAsync();
    System.Diagnostics.Debug.WriteLine("response string:" + responseAsString);

    webView.NavigateToString(responseAsString);


    This is the code I am using, actually I am using a local site with windows authentication, so i provided credentials, This code works and displays the login page, but when i click on login button, it generates that exception  "navCancelInit is undefined"  (after successful login i.e. after providing correct username and password ) . 

    Is it because of providing credentials ? The same site works good when i use web browser but when I use webview it gives that exception. If yes, Please suggest me any onother option to provide authentication credentials. OR please help me to sort out this problem.

    Wednesday, December 11, 2013 10:26 AM
  • You still didn't answer the question.  This doesn't sound like an exception from the app itself, but more that the web page you're displaying is throwing a javascript error.  You need to fix the webpage.

    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, December 11, 2013 12:56 PM
    Moderator
  • I have the same error and I don't think that the error comes from the destination page. This exception is thrown right after clicking a hyperlink on the WebView and the "NavigationStarting" event does not fire.  

    I have disabled the script debugging from the just in time debugger but the exception is still thrown.

    I don't know if it is related, but this behaviour started right after upgrading from VS 2013 to VS 2013 Update 3.

    Saturday, August 16, 2014 10:15 AM