Search code examples
ajaxurlhashnavigationhashbang

Inline navigation with hashbang pages


In the past, I used to rely on hash for inline navigation, for example:

http://url?Category=a&item=3#Paragrah1

(Pointing to Paragraph1 within the http://url?Category=a&item=3 page)

With the widespread use of ajax, the hash tag has switched to a different purpose, allowing page refresh without full page reload. For example:

http://url#!Category=a&item=3
http://url#!Category=a&item=4 (the page switches to item 4, no full page reload)

My question: how can I make inline navigation work in such pages? To take the above example, how can I point to Paragraph1 in the http://url#!Category=a&item=4 page?


Solution

  • Use the HTML5 history API instead. Then you can use the hash for scrolling again.