I am trying to return the last marker view and zoom level to the user when he access some other pages and returns to the map page. Right now, I am using cookies to do it. Just want to find out if there’s a conventional way of dealing with this, thanks:
When the user clicks on a marker, store them into cookies:
var latLng = map.getCenter();
var currZoom = map.getZoom();
$.cookie("map_center", latLng);
$.cookie("location_id", locationid);
$.cookie("curr_zoom", currZoom);
Retrieving the last viewed marker location and zoom level when he returns to the map page:
var lastViewedActivity = $.cookie('location_id');
var lastViewedMapLocation = $.cookie('map_center');
var lastViewMapZoom = $.cookie('curr_zoom');
This is definitely the way to go; your other options would be: