Android Question webview load url does not open android_asset files

korn

Member
Licensed User
Longtime User
when webview is used with load html, any html reference to images,js,etc in file:///android_asset works perfectly.

but when webview is used with loadurl('http://someserver.com') then any html tag reference to images,js, etc in android_asset does not load.

is it true that only html loaded locally from android_asset can use images,js from asset folder. and when we load html from external server, webview cannot access asset files.
 

korn

Member
Licensed User
Longtime User
thanks for your reply.

i am using 3.20 version, which does not support #DebuggerForceStandardAssets: true attribute.

since i have tested with two webviews (one with loadhtml & another loadurl), as one of the webview loads asset picture. so i think file is properly copied to project asset folder.

warwound, i am referencing files as <img src ="file:///android_asset/file.jpg" /> so it is not relative reference.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
The WebView can be unpredictable in behaviour.
Whether it will recognise your file based links or not i am not sure.
(And no doubt different versions of Android will behave differently as seems the way with the WebView :().

Can you modify your links so they are relative to the assets folder:

PHP:
<img src ="file.jpg" />

Does that work?

Martin.
 
Upvote 0
Top