At the beginning, I wanted to achieve a map effect in my resume: get the current position of HR automatically, and make distance difference with my location. If within the corresponding range, the corresponding dialog box pops up Balabala. The initial code was written and tested in the browser (Chrome for Mac) and the browser was asked to http://www.googleapis.com for latitude and longitude. See this domain name heart is half cold, because of well-known reasons, that is not that what geolocation can not get geographic information. Turn over some documents, ask some experts, found that the problem in the desktop browser may be non-solution.
In the HTML5 documentation, the location information about geolocation, including GPS, IP address, RFID, WiFi and Bluetooth MAC address, and Gsm/cdms ID, and so on. But the specification does not specify the use of these equipment sequencing, in the specific implementation, mobile phones and other mobile devices will be preferred to use GPS positioning, and notebook and without GPS tablet, the most accurate location is WiFi, as for the network cable Internet desktop, generally only use IP to locate, accuracy is worrying.
In these methods, GPS positioning is best understood, the satellite directly gives the location data. and the WiFi and IP address location, are not the browser itself can be achieved. Both of these methods must be the IP address or the WiFi signal collected around the routing information, upload to a server, the server's query calculates the location information, and then returned to the browser. However, Firefox, Chrome, opera and other mainstream browsers are provided by Google's API to query, the wall may be very large.
The final possible solution is:do not use this API on your PC. One query API is wall, and secondly, even if not by the wall, at most can only be done by IP address to find your city.
Technically there may be no solution, but there are some ways to solve the problem from an interactive point of view: for example, deliberately locating the error, giving the user the prompt to manually change the current coordinates (by searching or dragging the start pointer).
Before the question asked: https://www.zhihu.com/question/39362267
About Html5-geolocation