history.js
history.js copied to clipboard
Prevent popstate on hashes beginning with special character
Hello,
I recently encountered an issue with history.js on one of my projects - basically the gist of it is that every link that has /.? in its hash is treated as a url redirect (due to isTraditionalAnchor function). Unfortunately if I've got a page, where I use history.js with pushStates that I define, and links to other pages in format of /a/#/b/ where I don't want to use history.js for at all, it's currently impossible to do.
For example:
- I have page /a/ where clicking on links opens popups
- I can easily parse the URL to treat everything after # as which link / popup to open
- if then I set on page /c/ a link to /a/#/b/, clicking on that link won't open a popup, but redirect me to /b/ due to history.js
I've posted an SO (http://stackoverflow.com/questions/24757216/history-js-and-header-redirection) question regarding this, but unfortunately had to resolve the issue myself. The solution would be to change isTraditionalAnchor to treat hashes that begin with ! as anchors. Or any other combination of #[character].
As I'm not knowledgeable if this solution won't cause other problems, and don't know about the workings of history.js I hope I'll get an answer here.
Thanks!
Hello, I have same problem. I want to have flag in this library that will be able to turn off automagic-url-anchor-replacement-stuff.