Home >Web Front-end >HTML Tutorial >How to get the latitude and longitude of an address using HTML5 geolocation or Google API?
#In order to get the latitude and longitude using HTML5 Geolocation or any Google API, we need to add JavaScript for this.
The script is as follows -
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.'); }
The above is the detailed content of How to get the latitude and longitude of an address using HTML5 geolocation or Google API?. For more information, please follow other related articles on the PHP Chinese website!