I use wkwebview to load one js file(not js string) and show webp file,but it doesn't work.
I think the problem is in the loading way of the js file.
B4X:
Sub WKWebView_PageFinished (Success As Boolean, Url As String)
Dim jss As String
jss=$"<script type="text/javascript" src="${WebViewAssetFile("webpjs.js")}"></script>"$
WKWebView.EvaluateJavaScript("", jss)
End Sub
B4X:
Sub WebViewAssetFile (FileName As String) As String
Return $"file://${File.Combine(File.DirDocuments, FileName)}"$
End Sub
Best way to load files from the assets folder is with XUI.FileUri.
Note however that LoadUrl doesn't work with assets files. Better to copy the files to File.DirInternal and load them from there.
If you do choose to use File.DirAssets then test it in release mode as well.
Best way to load files from the assets folder is with XUI.FileUri.
Note however that LoadUrl doesn't work with assets files. Better to copy the files to File.DirInternal and load them from there.
If you do choose to use File.DirAssets then test it in release mode as well.
Erel,thank you.
I know that WKWEBVIEW does not currently support webp format images. Some people have used js to implement this function. I have not learned javascript. Although I tried to use this js plugin, I have not succeeded. Since there is not much time to solve this problem, I temporarily give up.