Android Question webview, how to know if the whole page or resource has been loaded?

omarruben

Active Member
Licensed User
Longtime User
B4X:
webview1.LoadURL("http://3fmdigital.com/lastposts.php")
B4X:
Sub Webview1_PageFinished()
  ' is this correct?'   
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I often find that the _PageFinished event occurs way before all the elements of a page are loaded.

What I have done that seems to work much better is inject some javascript in the page when the _PageFinished event occurs, which will then trigger another event:

B4X:
Sub wv_PageFinished (URL As String)
    Dim Javascript As String
    
    Javascript="B4A.CallSub('GetTitle_Event', false, document.title)"
    wve.executeJavascript(wv, Javascript)   
    
End Sub

And this is the event sub that triggers when all the elements of a page have loaded:

B4X:
Sub GetTitle_Event(Title As String)
    'page fully loaded
End Sub
 
Upvote 0

Similar Threads

Top