igor-alexandrov / wiselinks

If Turbolinks are not enough for you. Wiselinks makes your application work faster.
MIT License
724 stars 89 forks source link

Control hashbang #26

Closed waiting-for-dev closed 11 years ago

waiting-for-dev commented 11 years ago

I have noticed that an automatic hash is created for HTML4 browser. This is a great fallback, but the final URL for them is quite ugly because the id generated. It would be great if we could have some control over the hash generated, for example using a data-hash attribute.

igor-alexandrov commented 11 years ago

You can disable HTML4 support on Wiselinks initialization:

$(document).ready ->
    window.wiselinks = new Wiselinks($('body'), html4: false )

Isn't it what you want? In HTML4 browsers there is no other way to control state, but the hash. Or I don't understand completely what you want?

waiting-for-dev commented 11 years ago

No, I don't want to disable HTML4 support. What I want, for example, is to have a link:

link_to "About", some_path, 'data-push' => true, 'data-hash' => 'about'

That generates a:

http://localhost:3000/#!about

insted of:

http://localhost:3000/#!about&suid=65326536263562

(I don't know exactly the fashion of the generated URL's. I don't have right now an HTML4 browser, I checked it yesterday).

Is it possible?

igor-alexandrov commented 11 years ago

We need suid anyway, because it stores current state of HTML history, that is emulated in Internet Explorer and other HTML4 browsers. suid is a key in a Hash that stores states.

waiting-for-dev commented 11 years ago

Ok, then there is not a lot we can do... thank you anyway!

igor-alexandrov commented 11 years ago

Done in 1.0.0 release, no more ugly _suid. Thanks to awesome History.js library.

waiting-for-dev commented 11 years ago

Thanks a lot!! :)