P
Peter Michaux
A couple years ago I remember discussing here the idea of a single
page application setting the URL hash as a means of allowing
bookmarking and the back button to work as "expected". Navigating
through a one page app, the user would see the URL change
http://example.com/#page1
http://example.com/#page2
http://example.com/#page3
JavaScript would change the hash part of the URL so the user could
bookmark any screen and return to it. Setting the hash adds to the
browsers history so the back button also works.
At the time of the discussion I think there were browsers that
refreshed the page when setting the URL hash. I believe Safari 1 or 2
might have been doing this. Perhaps Opera as well. I remember Yahoo!
maps was setting the URL hash and basically didn't work in some
browers. Google maps, on the other hand, had and still does have a
little "link" link that gives the user a permalink they can send to
others to show the same screen (map position, zoom, etc.)
At the time, I remember Richard Cornford pointed out that there is or
was no standard dictating whether or not the browser should refresh
when the hash is changed through JavaScript. The situation seems to
have stabilized and all the major browsers do not refresh when setting
the URL hash through JavaScript. A de facto standard behavior seems to
have emerged.
I now see that Gmail and Facebook are both using URL hash setting as a
means of managing one page applications. Considering these pages both
take long to load, using Ajax to update little bits of the screen
(even the whole middle of the screen) is snappier than a full page
load. (Perhaps good caching could make the snappy same result?)
With important/popular one-page apps using URL hash setting, it seems
like a technique that is probably here to stay.
Has anyone here worked on a big application using URL hash setting for
navigation management? Any gotcha's learned through experience working
on them?
page application setting the URL hash as a means of allowing
bookmarking and the back button to work as "expected". Navigating
through a one page app, the user would see the URL change
http://example.com/#page1
http://example.com/#page2
http://example.com/#page3
JavaScript would change the hash part of the URL so the user could
bookmark any screen and return to it. Setting the hash adds to the
browsers history so the back button also works.
At the time of the discussion I think there were browsers that
refreshed the page when setting the URL hash. I believe Safari 1 or 2
might have been doing this. Perhaps Opera as well. I remember Yahoo!
maps was setting the URL hash and basically didn't work in some
browers. Google maps, on the other hand, had and still does have a
little "link" link that gives the user a permalink they can send to
others to show the same screen (map position, zoom, etc.)
At the time, I remember Richard Cornford pointed out that there is or
was no standard dictating whether or not the browser should refresh
when the hash is changed through JavaScript. The situation seems to
have stabilized and all the major browsers do not refresh when setting
the URL hash through JavaScript. A de facto standard behavior seems to
have emerged.
I now see that Gmail and Facebook are both using URL hash setting as a
means of managing one page applications. Considering these pages both
take long to load, using Ajax to update little bits of the screen
(even the whole middle of the screen) is snappier than a full page
load. (Perhaps good caching could make the snappy same result?)
With important/popular one-page apps using URL hash setting, it seems
like a technique that is probably here to stay.
Has anyone here worked on a big application using URL hash setting for
navigation management? Any gotcha's learned through experience working
on them?