-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are url hashes supported with pushState: true? #144
Comments
Actually this happens in location-bar lib on |
ok I solved it by settings location to BrowserLocation with custom options. Setting hashChange: false do the trick
|
ahh.. that only works for initial router call, further transitions don't work anymore :/ |
You want to use both pushState and hashes at the same time? As you've noticed - cherrytree in pushState mode will replace #/foo to /foo on startup. I will implement an option to disable this behaviour. This way, cherrytree will just use the URL as is and leave the hash alone. I might even look into exposing the hash as part of the router params. The tricky bit here is that the automatic fallback to hash behaviour will kind of break. Tbh I don't know if browsers without |
I just want to use pushState (without legacy hash change) where urls may also include hashes. |
With hashes included what would then happen when you'll navigate to same path and only the hash part will change? Transition won't fire, right? ..just hash part will change in url? |
That's a good question, will have to try and find out. If I start passing hash as one of the params, then it might make sense to fire a transition (just like if a query param changes). If I don't pass hash as one of the router params to transition middleware, then perhaps I should ignore hash changes. Also - I'm not sure if I can even detect hash changes and push state changes at the same time in any sensible way. |
I wouldn't fire transition if only the hash part changes, but url should be updated anyway. It looks like hash change won't fire a page jump (http://lea.verou.me/2011/05/change-url-hash-without-page-jump/) when changed via pushState, but thats ok I guess. If you are using pushState, you control what happens. |
Hey, so this is still a very interesting issue for me, as making it possible to utilise hashes in cherrytree sounds like it could be a useful feature, e.g. for anchoring/scrolling to page elements like it's intended, or to encode some clientside params. I don't have the time to look into how to implement this right away, but I'll keep this issue open for now. |
/login#something ...works
/#something ...is not found, while / works
and on initial load /#something is replaced with /something
The text was updated successfully, but these errors were encountered: