1.HTML5 get Current location
HTML5 geolocation API (Geographic application interface) to get the current location, mobile phone with GPS, computer based on the network location
Check to see if the browser supports the HTML5 geolocation API
<script type= "Text/javascript" >
if (navigator.geolocation) {
alert (' Browser support geolocation! ');
} else{
alert (' Browser does not support geolocation! ');
}
</script>
3 Call methods are provided
Gets the user's current location
void GetCurrentPosition (onsuccess, OnError, options);
Continues to obtain the user's current position, Showlocation represents the callback method
int watchposition (showlocation, OnError, options);
Cancellation of monitoring, Watchid for watchposition return value
void Clearwatch (Watchid);
Onsuccess after successful callback method (required)
OnError failed callback method (optional)
Options other parameters (optional)
Options = {
enablehighaccuracy,//Boolean, require high-precision geo-information
timeout, //maximum latency, default 0 milliseconds
maximumage //Application cache time
}
2. Call Baidu Map Show
<! DOCTYPE html>