Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
How to add #hash for the urls / pushState
-
I am new in this framework - looks great!
When i go to page2.html i want #hash (
index.html#page2
I don’t find this idea in the docs (Framework7 for example call this pushState).
Thanks.
-
There’s no support for URLs built in to Onsen UI but you can add it quite easily:
document.querySelector('#myNavigator') .pushPage('page2.html', {data: {hash: 'page2'}}) .then((page) => { window.location.hash = page.data.hash; });
(Note: I haven’t actually tested the line that sets the hash in this example but something like this should work.)