voyager
voyager copied to clipboard
How can i handle web browser history in web platform
Hi,
With voyager navigation, i cant see any option to interact with browser history or url. For example, controlling the browser history back and forward button and changing the content according to that, And during navigation, changing the url in browser. And also if we change url directly in the browser, how to handle that case with tab navigators and navigators in voyager.
Thanks
Without a routing system this will not be easy to be handled on Voyager. Browser stack is to limitaded to store all voyager stack info and all browser history info is path based. So, I'm trying bring Kotlin Routing to Voyager here and I have a little experiment using browser APIs here that is not complete yet.
Great, yes, then it will be possible. waiting for that. I was also looking into ktor routing to manually do all this stuff with voyager navigator. But thanx to you, now we can probably get this in voyager very soon i think.
@programadorthi Do you have any updates about these changes or when they will be available?
I needed it so I added it to my fork https://github.com/Syer10/voyager
You can reference https://github.com/programadorthi/kotlin-routing/tree/main/samples/kotlin-js-sample/src/jsMain/kotlin for adding support to control browser history, its not in the library but its not difficult to port the sample to Voyager-routing.
If you're looking for inspiration, I recently implemented it in my (non voyager) library - WasmHistory.kt