Hi:
I can't test it right now (I'm getting an error installing to the device), but, have you try with:
'Return True to close, False to cancel
Private Sub B4XPage_CloseRequest As ResumableSub
If WebView1.IsInitialized Then
WebView1.Back
Return False
End If
Return True
End Sub
I updated the code in order to handle the different back method names and to handle the B4XPage back and it works fine on Android.
Within B4i I got a sintax error that says: "unknown member: url".
Searching among the webview methods in the B4i version, in fact, there is no url method (unlike the B4A version).
So, mainly for me now this is the problem. That is, the vebview (in my project it is that of the news list) is opened via a button on the "Home" page of the app.
The webview opens a web page that lists the titles of the news (articles) and the user can open the detail of the single article by touching the image. The code then allows you to navigate (back) from the full article page to the news (articles) list page.
If you press the back button and you are on the news list (
https://mysite.com/content/news) the code related to the webview is not executed but instead the B4XPage "home" is displayed (then the navigation switches to B4XPages ).
o now, the main problem is that this code only works correctly on the android version of the app but instead i should make it work on the ios version of the app as well.
Some idea to solve this ?
'Return True to close, False to cancel
Private Sub B4XPage_CloseRequest As ResumableSub
If WebView1.IsInitialized Then
If WebView1.Url <> "https://mysite.com/content/news" Then
#if B4A
WebView1.Back 'android
#End If
#if B4i
WebView1.GoBack 'iOS
#End If
Return False
End If
End If
B4XPages.ShowPage("AppHome")
Return True
End Sub