locked
Loading html files with styling and images into webview from ApplicationData Localfolder RRS feed

  • Question

  • Hello

    I have an app where I need to display html files inside Webview. I cant use function .NavigateToString function because styling wont appear and images too.

    The files I want to show(html,css,images) are all inside .zip file. I download the zip file using BackgroundDownloader and save it inside

    StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(filename + ".zip",
                        CreationCollisionOption.ReplaceExisting);

    After that I extract the zip file and loop over files inside it. All I need to know if there is a way to show the files inside webview with styling and images appearing. I found a solution to this by using localhost for navigate function

     webView1.Navigate(new Uri("http://localhost:8088/" + ....

    But found that localhost cant be used in released version of an app. And webview can show files with navigate function for files inside the project. But my files are downloaded into ApplicationData Localfolder which is outside the project folder.

    Is there any other way to do that?

    Wednesday, October 23, 2013 7:37 AM

Answers

  • Are you using Windows 8 or 8.1?  There are new WebView methods in 8.1 that make this really easy.

    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, October 23, 2013 12:29 PM
    Moderator
  • You need to upgrade to the released version of Windows 8.1.

    --Rob

    Wednesday, October 23, 2013 2:05 PM
    Moderator

All replies

  • Are you using Windows 8 or 8.1?  There are new WebView methods in 8.1 that make this really easy.

    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, October 23, 2013 12:29 PM
    Moderator
  • I used to work with window 8. I have recently upgraded to 8.1. Is there anything new in 8.1?

    I am currently trying to upgrade from vs 2012 to vs 2o13 but setup is getting blocked saying that  "This version of Wisual Studio is not compatible with pre-release versions of Windows 8.1"

    • Edited by Mahagh Wednesday, October 23, 2013 1:22 PM
    Wednesday, October 23, 2013 1:21 PM
  • You need to upgrade to the released version of Windows 8.1.

    --Rob

    Wednesday, October 23, 2013 2:05 PM
    Moderator