iOS Question Get current URL from WKWebView

Pendrush

Well-Known Member
Licensed User
How can I get current URL from WKWebView with NativeObject as isn't possible to get current URL from PageFinished (described here)?
 

Pendrush

Well-Known Member
Licensed User
I have some situation where PageFinished is called multiple times, also I need current URL for share button.
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
I have some situation where PageFinished is called multiple times
It probably happens due to redirections.

Code to get current url:
B4X:
Sub Page1_Click
   WKWebView1.EvaluateJavaScript("", $"
       window.location.href
   "$)
   Wait For WKWebView1_JSComplete (Success As Boolean, Tag As Object, Result As String)
   If Success Then
       Log("Current page: " & Result)
   End If
End Sub
 
Upvote 0
Top