windows-8 – 将本地HTML加载到WebView中

前端之家收集整理的这篇文章主要介绍了windows-8 – 将本地HTML加载到WebView中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我可以将本地 HTML文件(带图像和…)加载到WebView中吗?
只是设置Source参数不起作用.
只要文件是应用程序包的一部分,您就可以从文件加载它,例如:
WebView2.Source = new Uri("ms-appx-web:///assets/text.html");

WebView.Navigate

WebView can load content from the application’s package using
ms-appx-web://,from the network using http/https,or from a string
using NavigateToString. It cannot load content from the application’s
data storage. To access the intranet,the corresponding capability
must be turned on in the application manifest.

对于“随机文件,我想你可以通过文件选择器提示用户选择文件然后将其读入字符串并使用NavigateToString,但根据你想要完成的内容,用户体验可能有点奇怪.

原文链接:https://www.f2er.com/windows/364300.html

猜你在找的Windows相关文章