How to use the current location in HTML5
If you would consider adding a function on your website to determine the position of your visitors there is no better way to do this then by making use of HTML5 and its HTML5 Geolocation API. This geolocator is compatible with all modern browsers (not with old browsers) and with smartphones and tablets. This functionality even excels on smartphones and tablets because of the often integrated GPS. Nevertheless, taking into account privacy regulations, visitors will always have to grant their permission before determining their position. The current location can be determined by means of the getCurrentPosition() method which on its turn will display the visitor’s location. Because this functionality is not supported by older browser it is of course advisable to inform people of possible geolocation failures or error messages s. Download below a working HTML5 Geolocation example.
Download Zip