iOS Question WKWebView, how to pass URL parameters to Main?

b4xscripter

Member
Licensed User
Longtime User
Hello,

I have a little problem trying to communicate some parameters to Main from WKWebView.

Let's suppose that I have this:

B4X:
Sub Process_Globals
Public App AsApplication
Public NavControl AsNavigationController
Private Page1 AsPage
Private WKWebView1 As WKWebView
End Sub

and this:


B4X:
Private Sub Application_Start (Nav AsNavigationController)
 NavControl = Nav
 Page1.Initialize("Page1")
 Page1.RootPanel.LoadLayout("Page1")
 NavControl.ShowPage(Page1)
 WKWebView3.Loadurl("http://www.myweb.com:7095/promotions")
End Sub

OK, now, let's imagine that I have a dynamic link on html (that I have in WKWebView3), something l like
B4X:
<a href="http://www.myweb.com:7095/test?param=10">Click here</a>

What I want is recover this parameter (in url) from Main and execute some action, let's suppose
B4X:
Log("clicked")

Obviously, I can do it using firebase messaging..... But I think, I could try to intercept this action from WKWebView.

Could someone help me?

Thanks a lot!
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…