[openstreetmap-website] Use a hash anchor for location/zoom persistence (#378)
John Firebaugh
notifications at github.com
Wed Jul 24 16:24:42 UTC 2013
Geohash is an interesting concept, but for this purpose we want something where the location and zoom can be read off the URL directly -- it's handy to be able to look at the location bar and see what zoom level you're at.
The ITO solution uses [sesssion history management](http://caniuse.com/#search=replaceState) (in particular, `history.replaceState`), which is less widely available than `location.replace` (it's notably missing from IE<10). I would eventually like to progressively enhance part of OSM.org using `history.pushState`, but in my opinion it's best used for a different purpose:
* `history.pushState`: Progressively enhance sites to add seamless, fast page loads between conceptually different pages. The GitHub file browser is an example of a good use.
* `location.replace`: Change the URL hash to reference a different section or location on the existing page -- in other words, for similar cases as a normal hash anchor.
Importantly, both of these uses preserve the normal browser history semantics; `history.pushState` adds to the history when navigating to a conceptually different page, and `location.replace` _avoids_ adding a history entry for the conceptually same page.
---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/378#issuecomment-21497102
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20130724/8aaae846/attachment-0001.html>
More information about the rails-dev
mailing list