I have simplified the syntax to add Live Permalinks to an OpenLayers map with my cdauth’s map API. These Permalinks are stored in the part after the # in your browser’s address bar, so when you reload the page, everything will be exactly the same and you can easily send the link to your friends. You can then also use your browser history, so when you hit the “Back” button in your browser, the previous map view will be loaded. Try it out on http://osm.cdauth.de/map/.
To add the functionality to your map, include http://osm.cdauth.de/map/prototypes.js into your web page and replace the constructor “OpenLayers.Map” with “OpenLayers.Map.cdauth”. Then add an OpenLayers.Control.cdauth.URLHashHandler object to your map either by putting it into your controls array or by using the following code:
var hashHandler = OpenLayers.Control.cdauth.URLHashHandler();
This will keep the location hash part in sync with the current map view, so the location will be updated when the map view is changed and the map view is updated when the user changes the location hash part manually (or opens a Permalink someone sent him).
Read more about my API on http://wiki.openstreetmap.org/wiki/Cdauth’s_map/API.
Comment from ColinMarquardt on 26 November 2009 at 00:23
Cool. I will certainly use this.
Comment from Flose on 26 November 2009 at 15:56
very useful feature.
When dragging, the map the coordinates shouldn't be refreshed all the time, just when one stops dragging because otherwise you can't really use the browser's back button.
Comment from Candid Dauth on 4 December 2009 at 18:13
Yep, that’s something I’ve wanted to implement for some time, done now.