locked
navigation of page on webview RRS feed

  • Question

  • hi,

    I have loaded an html page on to webview(using webview.navigatetostring(htmlstring)). Now I am trying to navigate to another html page on a click of a button.

    on the button click I am calling a javascript method where I have written code to navigate. the code is as shown below :-

     function Navigatepage()
                    {
    window.location = "file:///C:/Users/299022/AppData/Local/Packages/d273e27f-c995-41f7-ac8f-c1bbb30f3fc7_zxm9vhhs7aws0/LocalState/abcfolder/page2.html";
                    }

    i am unable to navigate to page 2. I have two queries :-

    1. can i navigate to a page using window.location in winrt ?

    2.can i give the local folder path ?

    Also kindly help me for getting a work around for the same to navigate to another page.

    Also for ref, i have wriiten similar code for wp8 which i am able to run successfully.

    The error what i am getting in my code here is , 'navcancelinit' is undefined.(visual studio run time debugger error).

    kindly help me to get a solution .

    thanks.

    Wednesday, July 17, 2013 1:19 PM

Answers

  • Hi,

    I was wondering if you got any solution for your issue. 

    If not, here is the code that worked fine while i tried navigating to next page on button click of the html page loaded in webView.

    Javascript:

    function nextPage() {
                window.location.href = "ms-appx-web:///Views/page2.html"; //or window.location = "ms-appx-web:///Views/page2.html";
            }

    xhtml:

     <button onclick="nextPage()">Next Page!</button>

    On button click, webview gets loaded with page2.html.

    Good luck!


    Friday, July 19, 2013 6:07 AM

All replies

  • Hi,

    You can navigate to another html page on button click by using webview.NavigateToString(htmlstring). htmlstring should be from the other html page which you would like to load. 

    For further solutions, you can follow this link http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx#AN4

    Also, you need to use "ms-appx-web:///abcfolder/page2.html" in webView control.

    Hope this helps you out.

    Good Luck!

    Thursday, July 18, 2013 6:16 AM
  • Hi,

    I was wondering if you got any solution for your issue. 

    If not, here is the code that worked fine while i tried navigating to next page on button click of the html page loaded in webView.

    Javascript:

    function nextPage() {
                window.location.href = "ms-appx-web:///Views/page2.html"; //or window.location = "ms-appx-web:///Views/page2.html";
            }

    xhtml:

     <button onclick="nextPage()">Next Page!</button>

    On button click, webview gets loaded with page2.html.

    Good luck!


    Friday, July 19, 2013 6:07 AM