[UWP] [WinJS] ms-appdata:///不会在Windows 10 App中的webview中加载图像 [英] [UWP][WinJS] ms-appdata:/// does not load images in a webview in Windows 10 App

查看:94
本文介绍了[UWP] [WinJS] ms-appdata:///不会在Windows 10 App中的webview中加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我们有应用程序(用WinJS编写),我们从webservice下载图像并将其存储在应用程序数据文件夹中(Windows.Storage.ApplicationData .Current.LocalFolder.Path)。然后将这些图像包括在webview内显示的内容中(对于
,例如< img src =" ms-appdata:/// local / [empid] .png]")。问题是"ms-appdata:/// local"似乎没有在weview内部工作。我检查它确实在主应用程序页面中工作(由WinJS加载)。但这不是我们的
选项。由于图像的大小,DataURI对我们来说也不是一个好选择。

We have app(Written in WinJS) in which we download images from a webservice and store it in the application data folder (Windows.Storage.ApplicationData.Current.LocalFolder.Path). These images are then included in the content displayed inside a webview (for e.g. <img src="ms-appdata:///local/[empid].png]"). The issue is that "ms-appdata:///local" does not seem to be working inside the weview. I checked that it does work in the main application page (loaded by WinJS). But that is not an option for us. DataURI are also not a good option for us because of the size of the images.

这是一个已知问题吗?现在有了支持整个WinRT API的webview,我原本预计也会支持ms-appdata:/// local。

Is this a known issue? With webviews supporting the entire WinRT APIs now, I would have expected that ms-appdata:///local would be supported as well.

任何帮助都将不胜感激

谢谢,

Venkata

推荐答案

您好这是预料之中的。您可以尝试在Microsoft Edge中键入该地址,但它不起作用,因此它在WebView中也不起作用。您必须使用硬盘驱动器上的本地路径,并使用完全使用的Windows.Storage.Application.Current.LocalFolder.Path,你已经在img src中提到过了(你的文件名加入了它)。
Hi it is expected. You can try to type that address in the Microsoft Edge and it won't work, so it doesn't work in WebView either. You have to use local path on hard drive with using exactly Windows.Storage.ApplicationData.Current.LocalFolder.Path you have already mentioned in img src (with your file name joined to it).


这篇关于[UWP] [WinJS] ms-appdata:///不会在Windows 10 App中的webview中加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆