webview loaddata in android does not load a picture from img src

大憨熊 提交于 2019-12-11 02:08:58

问题


I use loadData method to load some html content into a webview, but when it encounters something like this :
<a href="http://www.anywebsite.fr/">some text</a><img src="http://www.anotherwebsite.fr/thewantedpicture" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
I only get this in the application :
some text
And if I'm not mistaken, this should also display the picture ? If someone has any lead, thanks...


回答1:


If you look at the documentation for the loadData() method you'll see it says:

Content loaded through this mechanism does not have the ability to load content from the network.

Try using the loadDataWithBaseURL() method instead.




回答2:


Perhaps you just need to add

<uses-permission android:name="android.permission.INTERNET" />

to your App Manifest.



来源:https://stackoverflow.com/questions/2906258/webview-loaddata-in-android-does-not-load-a-picture-from-img-src

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