In my app I have a webview in Page 2. When I press on the button in Page 1, I go to Page 2 and webview opens and I wrote username and password and log in to the web page. Then I go back to Page 1 for some reason. When I go back to to webview (Page 2) again, it reloads the web page and I have to log in again. How can I prevent reloading webview?
I try to detect whether url is loaded before or not but I couldn't do. I wrote the codes below. Where is my fault?
B4X:
Prosess_Globals
Dim UrlLoadedBefore As Boolean
Application_Start
UrlLoadedBefore = False
Sub BtnMap_Click
NavControl.ShowPage(Page3)
If UrlLoadedBefore = False Then
WebView3.LoadUrl("http://www.xxx.com")
End If
End Sub
Sub WebView3_PageFinished
UrlLoadedBefore = True
End Sub
Problem occurs again. I didn't understand why. I used to code below to prevent reloading. But I can not have success. Help please. How can I prevent reloading web page if it is loaded before?
B4X:
Sub Process_Globals
Dim UrlLoadedBefore As String
End Sub
Private Sub Application_Start (Nav As NavigationController)
UrlLoadedBefore = "False"
End Sub
Sub BtnMap_Click
NavControl.ShowPage(Page3)
If UrlLoadedBefore = "False" Then
WebView3.LoadUrl("http://www.taksi-m.com.tr/track")
End If
End Sub
Sub WebView3_PageFinished
UrlLoadedBefore = "True"
End Sub