S stevenindon Active Member Licensed User Jun 28, 2022 #1 Hello all, I have put in WKWebView in the designer view (Event Name : WKWebView1) and when i load a Url, Private Sub WKWebView1_PageFinished (Success As Boolean, Url As String) did not fire event. Is there anything that i need to configure so that PageFinished will fire event? *I have searched the forum for this and there is no clear indication what to set* Thought it should work by default...
Hello all, I have put in WKWebView in the designer view (Event Name : WKWebView1) and when i load a Url, Private Sub WKWebView1_PageFinished (Success As Boolean, Url As String) did not fire event. Is there anything that i need to configure so that PageFinished will fire event? *I have searched the forum for this and there is no clear indication what to set* Thought it should work by default...
Erel B4X founder Staff member Licensed User Longtime User Jun 29, 2022 #2 stevenindon said: I have put in WKWebView in the designer view Click to expand... Don't. Add the regular WebView. No need to do anything special: B4X: Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("MainPage") WebView1.LoadUrl("https://www.google.com") End Sub Private Sub WebView1_PageFinished (Success As Boolean, Url As String) Log("finished") End Sub Upvote 0
stevenindon said: I have put in WKWebView in the designer view Click to expand... Don't. Add the regular WebView. No need to do anything special: B4X: Private Sub B4XPage_Created (Root1 As B4XView) Root = Root1 Root.LoadLayout("MainPage") WebView1.LoadUrl("https://www.google.com") End Sub Private Sub WebView1_PageFinished (Success As Boolean, Url As String) Log("finished") End Sub
S stevenindon Active Member Licensed User Jun 29, 2022 #3 Erel, Thanks for the tips. So _PageFinished event only applies to Webview but NOT WKWebview. Thanks Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jun 29, 2022 #4 Never use WKWebView. Upvote 0
S stevenindon Active Member Licensed User Jun 29, 2022 #5 Hello all, I have changed to Webview instead of using WKWebview as advised above. The funny thing is as follows : Private Sub WebView1_PageFinished (Success As Boolean, Url As String) <<---- Event will ONLY be raised when i click a link INSIDE my html page. but when i create a button in native and on click WebView1.LoadUrl("http://myurl.com") <<----- this will not raise WebView1_PageFinished (Success As Boolean, Url As String) Question, How can i raise this event for both ways? Upvote 0
Hello all, I have changed to Webview instead of using WKWebview as advised above. The funny thing is as follows : Private Sub WebView1_PageFinished (Success As Boolean, Url As String) <<---- Event will ONLY be raised when i click a link INSIDE my html page. but when i create a button in native and on click WebView1.LoadUrl("http://myurl.com") <<----- this will not raise WebView1_PageFinished (Success As Boolean, Url As String) Question, How can i raise this event for both ways?
Erel B4X founder Staff member Licensed User Longtime User Jun 30, 2022 #6 It should work in both cases. I guess that your other page never completes to load. Upvote 0
S stevenindon Active Member Licensed User Jun 30, 2022 #7 Erel, I tried loading the same page : 1 from native : WebView1.LoadUrl("http://www.mywebserver.com/test.html") 2 another one from a link INSIDE a page - <a href="http://www.mywebserver.com/test.html">CLICK HERE</a> Only action 2 ---> Raised WebView1_PageFinished event Upvote 0
Erel, I tried loading the same page : 1 from native : WebView1.LoadUrl("http://www.mywebserver.com/test.html") 2 another one from a link INSIDE a page - <a href="http://www.mywebserver.com/test.html">CLICK HERE</a> Only action 2 ---> Raised WebView1_PageFinished event
Erel B4X founder Staff member Licensed User Longtime User Jul 3, 2022 #8 Try to reproduce it in a small project and upload it. Upvote 0