Effect (tested in the new version of Firefox):
Code:
<!DOCTYPE><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Google Map</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function init()
{
// Get the current location
navigator.geolocation.getCurrentPosition(function(position)
{
var coords = position.coords;
// Set map parameters and set the latitude and longitude of the current location as the center point
var latlng = new google.maps.LatLng(coords.latitude,coords.longitude);
var myOptions =
{
// Magnification
zoom:14,
// Mark coordinates
center:latlng,
// Map type
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map1;
// Show map
map1 = new google.maps.Map(document.getElementById('map'),myOptions);
// Create tags
var marker = new google.maps.Marker(
{
position:latlng,
map:map1
});
// Set the marking window, attach the comment text
var infowindow = new google.maps.InfoWindow(
{
content:"Current location"
});
// Open the label window
infowindow.open(map1,marker);
});
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>
Google Maps JavaScript API v3 (reference documentation): https://developers.google.com/maps/documentation/javascript/basics
Reference document for Baidu Map API: http://developer.baidu.com/map/jsmobile.htm