Answered by:
Windows 8.1 WebView accessing local HTML files

Question
-
This web page http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.webview says WebView can access local HTML files in Windows 8.1 apps:
"Support for the ms-appdata scheme with the LocalFolder and TemporaryFolder data stores. This enables navigation to URIs such as ms-appdata:///local/folder/file.html and ms-appdata:///temp/folder/file.html."
If I am not wrong NavigateToLocalStreamUrishould be used. Is this method the right one?
Furthermore, I wonder if the WebView will be able to load also images that have relative path in "src" attribute in the HTML file. Is it possible with NavigateToLocalStreamUri or other suitable method?
Monday, October 21, 2013 8:23 PM
Answers
-
It depends on your specific needs, but Navigate as demonstrated in Scenario3 will allow copying HTML and an Image to the local folder and then displaying them in the WebView.
Give it a try with your exact scenario to confirm!
--Rob
- Marked as answer by P5music Thursday, October 24, 2013 9:16 AM
Wednesday, October 23, 2013 12:13 AMModerator
All replies
-
Hi P5,
Yes, you'll use NavigateToLocalStreamUri. Take a look at Scenario 4 in the XAML WebView control sample .
--Rob
Tuesday, October 22, 2013 1:17 AMModerator -
Hello,
it seems that also Scenario3 is suitable for my needs. Am I wrong? I need to have a folder where to put persistent HTML pages (with image elements like <IMG src='img1.png'> inside) at runtime (they are not in the app package). So, Is it the Navigate() method suitable too?
Tuesday, October 22, 2013 9:17 AM -
It depends on your specific needs, but Navigate as demonstrated in Scenario3 will allow copying HTML and an Image to the local folder and then displaying them in the WebView.
Give it a try with your exact scenario to confirm!
--Rob
- Marked as answer by P5music Thursday, October 24, 2013 9:16 AM
Wednesday, October 23, 2013 12:13 AMModerator -
It seems that Scenario 3 is suitable for my needs, I tested it and it works. Thanks.Thursday, October 24, 2013 9:16 AM