Is there a way to modify
location.hash, so that it doesn’t trigger route transitions? How to generate URL like
I’ve got a chat-like app with a button that redirects user to a page with randomly generated room name. I’d like to display a modal with instructions that would include a URL of the page, so that it’s easy to share it with others. However, I’d like to display this modal only for the person who created the room, i.e. clicked the button. I thought about generating URL like
/rooms/123#show-instructions and then check hash value in
renderTemplate method, display the modal and remove the hash. This way the user would never see it, so if you decide to copy URL from the browser’s address bar instead from the instructions in the modal, it would still work correctly.
How to do it if I’m using
AutoLocation? If it makes things any easier, I could switch to
HistoryLocation, as the app only works with modern browsers, anyway.
I could use some kind of storage (cookie, localStorage etc.) and store information whether to show the modal there, but I thought that using
location.hash would be much cleaner in this case.