加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

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

发布时间:2020-12-14 04:20:19 所属栏目:Windows 来源:网络整理
导读:我可以将本地 HTML文件(带图像和…)加载到WebView中吗? 只是设置Source参数不起作用. 只要文件是应用程序包的一部分,您就可以从文件加载它,例如: WebView2.Source = new Uri("ms-appx-web:///assets/text.html"); 从WebView.Navigate起 WebView can load c
我可以将本地 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,但根据你想要完成的内容,用户体验可能有点奇怪.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读