Here’s what I’d like to do: in HTML5, I know there’s the geolocation “option”.
I’d like to make a form with “your name, your address”, and a button with a JavaScript code that says “auto fill with my geoposition” and if the user clicks on it, auto-fill the form.
I guess I may call third parties API like google maps or OpenStreetMap.
Anyone has ever done that? Any suggestion how to do this / where to look (there a tons of tools out there I’ve checked a lot, but nothing seems have samples of what I want to do).
Are you wanting to use the browser’s GeoLocation capabilities (HTML5)? If so, just call navigator.geolocation.getCurrentPosition() (see here).
This will get you the latitude and longitude which you can use to put a dot on a map using various mapping libraries.
If you are wanting to put their address, you’ll need to do a reverse geoLocation API call using Google, MapQuest, etc. All of these are very simple.
Keep in mind that this will only work with fairly modern browsers. Another option is to take the visitor’s IP address and use it to estimate their location against a database (MaxMind as @DanielNova suggested is a good option).
Hope this helps..
Greg