html - using URL hashes in javascript AND anchors -
we're using url hashes in places in our app filter display, e.g. #highlight=free
highlight our free content. use javascript process hash, listen hash changes. works great.
we're wondering best way mix "real" html anchor links. i.e. links point specific html id on page, e.g. #chapter-5
.
should implement jumping right place using javascript , stop relying on default browser behaviour? example, link #chapter=chapter-5&highlight=free
, handle both filter , anchor in javascript? or there safe/standard way "mix" anchors , custom hashes?
if target environment allows it, "safe/standard way" leave hashes old-school hash (commonly seen "hashbang") approach alone regular in-page anchors , use modern html5 history api instead.
if must support older browsers can use polyfill resorts hash.
Comments
Post a Comment