how to load image on webview from ms-appdata:///local

雨燕双飞 提交于 2019-12-12 19:58:37

问题


I'm developing windows store apps with html5/javascript. I have to load image from src " ms-appdata://local/testimage.png" to webview.I can't able to load the image using this src on navigateToString method.

Any help would be greatly appreciated


回答1:


You should try the ms-appx-web scheme.

I believe that if you place the content in a subfolder, ms-appdata should work too.

More on this on MSDN




回答2:


I recently updated my Visual Studio 2015 apache cordova project to visual studio 2017. I had few problems with working with angular js otherwise everything worked in windows 10 environment.

But what I noticed was images from ms-appdata:///local folder couldn't load to img tags. I tried many ways like row html, dynamic tag creation and add url as a base64 data url.

In base64 solution it worked. But I want to get the file itself as my app was supporting iOS and Android as well.

So after trying hundred things solutions was simple. You have to set img-src option to All ( * ) Content-Security-Policy meta tag of the html file.

Please check following screen shot. You need to add the part with the read border to load image resources from any location.

Please go to my blog for more cordova tips.

http://guntucomputerhacks.blogspot.com.au/2018/05/how-to-load-image-on-webview-from-ms.html



来源:https://stackoverflow.com/questions/24135761/how-to-load-image-on-webview-from-ms-appdata-local

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!