Here is a solution using the History interface of the browser. It could also support history state variables (only uses for currentScene for now). The scene name is also put in an escaped form into the browser URL (allowing hard page refreshes and deeplinks). If you don't want that, you can disable it.