avasin
avasin

Reputation: 9726

History.js rewrites location.hash value

I'm using HTML5 jQuery bundled History.js plugin. It's working fine, but i need to have ability to use links like (works fine without History.js)

http://website/url#popup=/url/some/more/params/

For a moment, if i will try to use it my hash page will be reloaded without hash - i've just tested this in environment with just History.js plugin (to ensure that is a History.js problem).

http://website/popup=/url/some/more/params/

But if i will try hash without "/" symbol, everything will be ok, location.hash will stay unchanged, no page reload will be made:

http://website/#popup=url

Problem is that i would like to use native urls in #popup parameter. It's easy to handle and displayed this way link will be clear to users, everyone will be able to share link after popup is opened.

Is it possible to disable such location.hash change and redirects? I really don't think that using links with special delimeres is good idea:

http://website/#popup=url:param:values

P.S. I've tried to apply encodeURIComponent() to popup url before adding it to location.hash, following url also removes hash and makes redirect:

http://website/#popup%3D%2Ftest%2Furl

Upvotes: 0

Views: 506

Answers (1)

tomdemuyt
tomdemuyt

Reputation: 4592

Your URL is not valid, forward slash should be %2F if it comes after the hash.

Furthermore, entering in the address bar

http://stackoverflow.com/questions/13953766/history-js-rewrites-location-hash-value#popup=eerste/tweede/derde

Will create #popup=eerste/tweede/derde in location.hash, which is correct.

Seems to me you should file a bug report with the authors of History.js

Upvotes: 1

Related Questions