Malis
Malis

Reputation: 220

History.js - prevent updating hashes

I'd love to use History.js for its ability to handle history (pushState etc.) in older browsers but I'd need to disable the default behavior that automatically converts hashes into a "normal" url path. By that I mean that by default the script changes link#hash to link/hash. It is great that if a push a state of "otherlink", it gives older browsers the #otherlink hash so it can still be handled but I need it to NOT automatically change link#hash to link/hash when the page is loaded. History.js seems to include an auto-initialize code so I don't even know how to load it with customized options.

To be specific, what I need is:

I hope it makes sense. If it doesn't I can provide more information. Thanks for help.

Upvotes: 0

Views: 619

Answers (1)

Denis Tsoi
Denis Tsoi

Reputation: 10424

https://stackoverflow.com/a/21673425/2903169

Quoted from previous answer I gave earlier today (retaining the hash in history.js seems to be a popular question)

Within the History.js github repo, you can set the options to force hashtags as Default

History.js Github Readme, Options Link

History.options.html4Mode If true, will force HTMl4 mode (hashtags)

Upvotes: 1

Related Questions