Can a webapp navigate to different pages, enabling the back button?

I do see how this could break things, but is there a way a webapp can navigate to actual different pages in the browser, making the browser’s back button functional inside the app?

Normally I display all content in containers on a single page, but now that I’m doing a mobile-friendly app, I’m running into the issue of users naturally hitting the back button to get to the previous screen (container), which unfortunately exits the browser completely (at least on android), since the browser hasn’t actually navigated to any other pages. Changing my containers to type Webpage, does not fix this - it does not make the app actually navigate to other webpages in a way that that browser recognizes and enables the back button on. Is there a solution to this?

You need to make the URL different for each page.

That is what Hashtag does.

Then the browser will keep a record of each page, and let you go back and forth.

But that is half of the work. The app has to react to the different HashTag and present the appropriate page. This is done in the Session.HashTagChanged event, where it displays the proper page.

Of course you must conceive your app so it shows the proper page content depending on the hashtag. You can even have users bookmarking a particular page and expecting to find it back later on by hitting the app just there. So it requires a bit of thinking with non static content.

Here is a proof of concept project :

http://rubberviews.com/xojo/backforward.xojo_binary_project

Does the “Hashtag” affect the browser history though?

Yes it does. It works perfectly with the project I posted.

Thanks for the project, @Michel!

You’re welcome.

I just updated the project. Now a bookmark or shortcut opens directly on the page in a new session open event. Same link.

I’m updating my project now to take advantage of this. Many thanks!

Something others may want to be aware of is that the Session.HashTagChanged ( ) event is only fired in response to users manually changing the hashtag in the address bar; the Session.HashTagChanged ( ) event does not fire when you programmatically change the hashtag in the address bar using Session.HashTag = “xyz”.

Indeed, do not use that to navigate.