Android Question load file webview file://android_asset/www/index.html

jsaplication.mobile

Member
Licensed User
Hello B4A Team,

I would like to bring to your attention an issue that significantly affects the development of hybrid applications in B4A. Over the past few years, I have noticed that support for loading local HTML files using the path file:///android_asset/www/index.html has been discontinued or no longer works properly in WebView.

Previously, this functionality was seamless and made it much easier to develop WebView-based applications. All resources such as images, scripts, and CSS styles were loaded without any issues. Furthermore, there was no need for manual adjustments or "workarounds" to make it work. It was possible to easily interact between HTML/JavaScript and native B4A code, creating a fluid experience for developers using this approach.

However, currently, despite attempts at workarounds, support for this feature seems to be broken. This is frustrating because it limits the ability to efficiently build hybrid applications, something that was previously one of the great advantages of B4A.

My request is: when will it be possible to restore native support for loading local files in WebView using the path file:///android_asset/www/index.html? This functionality was essential for many developers and helped keep B4A competitive as a development tool.

If there is any workaround or plan to fix this, I would be grateful to hear about it. I have always enjoyed working with B4A, especially because of the ease of integrating WebView with native functionality, but I feel that the lack of this feature is leaving the tool behind compared to other options on the market.

Thank you for your attention and I hope this functionality can be restored soon.

Best regards,
JSaplication
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Add to main module:
B4X:
#DebuggerForceStandardAssets: true

Load file with:
B4X:
WebView1.AllowFileAccess = True 'this was added in B4A v13.1. It might work without it as well.
WebView1.LoadUrl(xui.FileUri(File.DirAssets, "test.htm"))

1738823677807.png


Subfolders will make problems. You need to flatten the files structure. In most cases it is quite simple to do.
Upper case files will also cause problems.

Another option is to zip all files and unpack them in File.DirInternal.
 
Upvote 0

jsaplication.mobile

Member
Licensed User
Add to main module:
B4X:
#DebuggerForceStandardAssets: true

Load file with:
B4X:
WebView1.AllowFileAccess = True 'this was added in B4A v13.1. It might work without it as well.
WebView1.LoadUrl(xui.FileUri(File.DirAssets, "test.htm"))

View attachment 161419

Subfolders will make problems. You need to flatten the files structure. In most cases it is quite simple to do.
Upper case files will also cause problems.

Another option is to zip all files and unpack them in File.DirInternal.
It doesn't work when the files are in the www folder and in this html file there are links to other files like <img src="icones/photo.png">
 
Upvote 0
Top