Web page navigation

if me start a web page from android home screen link
and navigate with this
Session.CurrentPage = WebPage2

Session.CurrentPage = WebPage3
to other pages
if me press back the app ends!?
how can i goto previous page automatic with back key?

xojo 2021r1

That’s what WebSession.SaveState is for…

https://documentation.xojo.com/api/web/websession.html#websession-savestate

Whenever your app is in a state that constitutes a place that you’d like to go back to, call this method with a page name and any data you need to restore the state (if you’re just updating the current state, set replace to true). Then when the user presses the back button next time, the Session.HashTagChanged event will fire with the data saved for that state.

1 Like

ahhh, thank you Greg

that does not work always. if me set the currentpage in hashtagchanged
i can see the page title and the ui from old page.

example at button click in main window

Sub Pressed() Handles Pressed
  System.DebugLog CurrentMethodName

  Session.SaveState "Back","Main"
  
  Session.CurrentPage = WebPageView
End Sub

the session event

Sub HashTagChanged(Name as String, Data as String) Handles HashTagChanged
      Select Case Name
      Case "Back"
        Select Case Data
        Case "Main"
          Self.CurrentPage = WebPageMain
        Case "Data"
          Self.CurrentPage = WebPageDaten
        End Select
      End Select
    End Sub

@Greg_O_Lone
please can you explain the workflow to use multiple pages that the user also can use the back navigation?

Don’t use CurrentPage. Use Show. I’m not even sure why CurrentPage is writable off the top of my head.

1 Like

i used Show instead of CurrentPage but the problem stay.
2021r1 does not work with chrome at android phone or firefox at pc.
the page did not came in front, only the title caption.

@Greg_O_Lone
btw

oh yeah, I know that it’s writable. I’m just saying that it probably shouldn’t have been.

1 Like

i know from older xojo web version that the page swap works this way.
please test this entirety web framework
with chrome & firefox at android phone and windows with the utmost care.
preferably with a web app that test most of all common features that you would use at business.
i prepared 3 web projects but they are not in productive environment yet.