FacilMap/Version 1/API/HistoryStateHandler

From OpenStreetMap Wiki
Jump to: navigation, search

With the HistoryStateHandler FacilMap control, a Permalink to the current map view will always be displayed in the browser’s address bar. This enables the following features:

  • Use of the browser’s back button to jump to the previous map view
  • Easy sharing of links
  • Map view stays the same on page reload.

To add this feature to your OpenLayers map, be sure to include the FacilMap API:

<script type="text/javascript" src="http://api.facilmap.org/facilmap.js"></script>

Then add the control to the map using the following code:

map.addControl(new FacilMap.Control.HistoryStateChanger({ autoActivate: true }));

FacilMap HashHandler.png