Arctic Vowel
Arctic Vowel

Reputation: 1522

Display local html page inside WebView

I have an html file (which consists of both text and images) in my Documents library (it need not exactly be over there, what I mean to emphasize is - it's not in the internet and not included within the app package since it's dynamic content and created after the app has been deployed).

I want to display the contents of this page within a WebView. How would I go about doing that ?

Upvotes: 0

Views: 2130

Answers (1)

Andreas Fischer
Andreas Fischer

Reputation: 66

You can (and should) copy your HTML Files to the LocalState Directory of your App which sits here: C:\Users\YourUSerName\AppData\Local\Packages\YourApp\LocalState.

You then can Access this with: ms-appdata:///local/

Very Basic example:

string url = "ms-appdata:///local/myWebpage.html";
webView.Navigate(new Uri(url));

You can find a lot of Information and samples in this sample download: https://code.msdn.microsoft.com/windowsapps/XAML-WebView-control-sample-58ad63f7

Upvotes: 2

Related Questions