javascript - Best way to detect browser state changes -


and state mean url changes, preserving browser history.back() , being able update page (through callback guess) when there change.

i've tried several methods, , each 1 has pros , cons. example, way backbone.js manages urls router because works via window.location.hash (#) , if change url manually it's catched router allowing perform manual changes in easy way. thing don't backbone urls being in format "#/a/b/c/d/e" (against classic http standard "?a=1&b=2&c=3". means url parameters needs in order , don't have name. of course can fix parsing url , treating router expression single string, it's not big problem. also, think using backbone router it's bit overkill (including whole backbone that), i'd other solutions.

the next 1 history.js, supossed provide compatibility new html5 standard? don't behaviour as backbone's one. mean, in html5 browser, # converted ? , if change in url whole page reloaded. also, due lack of router, need set more listeners, $(window).bind('statechange') , $(window).bind('hashchange'). again not big problem, i'd know if there other ways this.

i "there's no right way something, different ways achieve it". able choose 1 of ways, i'd know different possibilities.

what think problem, more , more common when developing single pages? i've researched bit, answers found quite old (> 1 year+) i'm interested on state of art...


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -