Hi,
I am trying to display a web page in a webView view.
If the whole html is in a single string and loaded into the webView it displays correctly.
I want to separate the css from the js so I put them in individual files.
I copy the files from DirAssets to DirInternal, I have checked and they are there, but my page does not load them.
If I try using the URL method I get an ERR_ACCESS_DENIED message.
The .js and .css are in the same directory as the .html file.
Ideally I would like them to be in separate /css and /js directories.
Can anyone help with this?
Thanks
I am trying to display a web page in a webView view.
If the whole html is in a single string and loaded into the webView it displays correctly.
I want to separate the css from the js so I put them in individual files.
I copy the files from DirAssets to DirInternal, I have checked and they are there, but my page does not load them.
If I try using the URL method I get an ERR_ACCESS_DENIED message.
The .js and .css are in the same directory as the .html file.
Ideally I would like them to be in separate /css and /js directories.
Can anyone help with this?
Thanks
B4X:
File.Copy(File.DirAssets, "test.html", File.DirInternal, "test.html")
File.Copy(File.DirAssets, "test.js", File.DirInternal, "test.js")
File.Copy(File.DirAssets, "test.css", File.DirInternal, "test.css")
Dim css As String
css = File.ReadString(File.DirAssets, "test.css")
Log("Read WEB:" & css)
Dim html As String
html = File.ReadString(File.DirAssets, "test.html")
WebView2.JavaScriptEnabled = True
WebView2.AllowFileAccess = True
'WebView2.Loadurl("file:///android_asset/test.html")
WebView2.LoadHtml(html)
WebViewExtras2.Initialize(WebView2)
WebViewExtras2.Enabled = True
WebViewExtras2.Top = 400dip
WebViewExtras2.JavaScriptEnabled = True
WebViewExtras2.BringToFront