Working with browser history to support back and forward buttons

This was such a great demo - Thanks so much for sharing!

It took me a while to get my head around as javascript is a little foreign to me.
I had a play with the demo and tried adding some URL hashing which seemed very minimal additional code. Basically just an extra parameter in the ‘push_form_state’ function call and opening a ContentForm by the hash value.

I think it plays quite nicely with the demo you shared.

https://anvil.works/build#clone:EGXZCOBTHISCZGMR=WQDHI346FVBPTYGM6GZLLHNG

edit:
as @kevin mentions, you’ll need to use the share button to see the url hash working - it doesn’t work in the IDE. Here’s a link to a published version to see it working in practice https://witty-flawless-talk.anvil.app

4 Likes