I am making an application that show positions on maps, I have a page that links to the map, when I click that link, its change to the map page without load the map.
So I have to click the browser back button and refresh the page that have the link, after that I click again the link and the map is loaded at this time, so if you can help me to load the map with out refresh i will be grateful
<div data-role="page">
<div data-role="header">
<a href="menudep.jsp" data-icon="back" data-theme="c">Atras</a>
<h1><%=corto%></h1>
<h4><img src="../images/logo_mich.png" width="40" height="40" /></h4>
<a href="mobilelaip.html" data-icon="home" data-theme="c">Inicio</a>
</div>
<div data-role="content">
<p>
<%=descrip%>
</p>
<a href="map3.html">Ubicación</a>
<ul data-role="listview" data-inset="true">
<li><a href="oficio.jsp?dep=<%=id_dep%>">Info. Oficio</a></li>
<li><a href="contacto.jsp?dep=<%=id_dep%>" data-rel="dialog">Contacto</a></li>
<li><a href="paginaweb.jsp?dep=<%=id_dep%>" data-inline="true" data-rel="dialog">Pagina Web</a></li>
</ul>
</div>
</div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
// When map page opens get location and display map
$('.page-map').live("pagecreate", function() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
initialize(position.coords.latitude,position.coords.longitude);
});
}
});
function initialize(lat,lng) {
var latlng = new google.maps.LatLng(lat, lng);
var myOptions = {
zoom: 20,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
new google.maps.Marker (
{
map : map,
animation : google.maps.Animation.DROP,
position : latlng
});
}
</script>
And the map3.html code is this
<div data-role="page" class="page-map" style="width:100%; height:100%;">
<div data-role="header"><h1>Mapa</h1></div>
<div data-role="content" style="width:100%; height:100%; padding:0;">
<div id="map_canvas" style="width:100%; height:100%;"></div>
</div>
thanks for your answers