TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Using HTML5 geolocation API to get the distance of the visitor from me

41 pointsby miharover 13 years ago

5 comments

klinquistover 13 years ago
The author is incorrect about that being html5 - it's javascript.<p>I did this over two years ago with the same js call - I work for a company with multiple buildings. Go to a web page and you'll see a list of conference rooms in the buildings you are closest to and their availability. Found a web page to batch convert addresses to lat/long - made it pretty easy.<p>Here's something I wrote at the same time that shows your proximity to a city zip code.<p><a href="http://www.linquist.net/geo.php" rel="nofollow">http://www.linquist.net/geo.php</a>
评论 #3025181 未加载
abavaover 13 years ago
You can see that on the map. Visiting <a href="http://wayn.linkstore.ru" rel="nofollow">http://wayn.linkstore.ru</a> (on phones with Javascript support) will open the phone's email app with a canned message titled "Where are you now?" and a link to GeoMail in the email body. If the recipient is using a phone that supports the HTML5 location provider API, such as an Android or Samsung Bada device or an iPhone, when they click the link it will launch GeoMail webapp which lets them reply with a link to a Google Map showing their location.
tadrujover 13 years ago
Since JavaScript has 64-bit floating points you could use simpler Spherical law of Cosines (cos c = cos a cos b + sin a sin b cos C) instead of Haversine to calculate distance.
obtinoover 13 years ago
Geolocation is not a part of the HTML5 specification!
sleepyheadover 13 years ago
But please don't do this. "X.com wants to know your location - Ok - Cancel". Meh.
评论 #3025387 未加载