為了使用 HTML5 地理位置或任何 Google API 獲取緯度和經(jīng)度,我們需要為此添加 JavaScript。
腳本如下 –
if (navigator.geolocation) {
/* If current position is obtained then there is success otherwise there is failure.
On failure, separate error message is shown */
navigator.geolocation.getCurrentPosition(successFunc, errorFunc);
} else {
alert(‘Geolocation is not enabled in your browser. Please use a latest browser to supports it.');
}
登錄后復制
以上就是如何使用HTML5地理定位或Google API獲取地址的經(jīng)緯度?的詳細內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!






