How to access local assets from a remote URL in Android WebView?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 17:24:27
tarkeshwar

You can't link to a local resource from an external page. That is due to security reasons.

See Pekka's answer for a similar question: How to show local picture in web page?

dres

Extend WebViewClient and override shouldInterceptRequest to load the file locally. The urls would all appear remote but you can selectively load which every you need.

http://developer.android.com/reference/android/webkit/WebViewClient.html#shouldInterceptRequest(android.webkit.WebView, java.lang.String)

Also answered here: webview shouldinterceptrequest example

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