B4J Question WebView findAll or other find on the page

peacemaker

Expert
Licensed User
Longtime User
Hi, All

How to implement searching and WebView scrolling to the found result ?
For local HTML-file loaded into the webview.

This does not work:
B4X:
reflector.RunMethod2("findAll", s, "java.lang.String")   'java.lang.NoSuchMethodException: java.lang.Object.findAll(java.lang.String)
What is the docs of the B4J WebView class ?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Solved via JS for Internet URL opened:

1642746079429.png


B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private wv As WebView
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
 
 
    wv.LoadUrl("http://b4x.com")
End Sub

Sub Button1_Click
    ExecuteJavaScript(wv, "window.find('community)")
End Sub


#Region WebView JS
Sub ExecuteJavaScript (wv2 As WebView, script As String) As Object
    Dim jo As JavaObject = wv2
    Return jo.RunMethodJO("getEngine", Null).RunMethod("executeScript", Array(script))
End Sub
#End Region

But it does not work for local HTML if to use:

B4X:
Dim uri As String = File.GetUri("P:\folder", "local_file.htm")
wv.LoadUrl(uri)

Heeelp, pls !
 
Last edited:
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Hmmm, seems, solved, as found that not any HTML-file can be searchable inside the WebView.
But desktop Chrome is searching anyway.
 
Upvote 0
Top