Ways to get location of the client from the browser?

前端 未结 6 1661
情深已故
情深已故 2021-01-06 04:40

What i need is the lat/long of the client(via browser)

Found some articles on the net,found some in stack overflow itself(an old article) Get GPS location from the w

6条回答
  •  既然无缘
    2021-01-06 04:59

    The user can be located by using following ways:-

    1. Using the IP addr. easiest to achieve but most unreliable due to the uncertainty of network addresses / topologies.
    2. Using the latitude, longitude pair most accurate solution, but most of the end users don’t know about their latitude, longitude value.
    3. Using the zipcodes nice to think but quite difficult to achieve, although ZipCodes are being used for
      quite a long time but this is not a standard yet. (see link
      http://en.wikipedia.org/wiki/Postal_code ). ZipCode alone is not sufficient for calculation of distance we need to convert it to latitude, longitude pair which is an
      overhead.
    4. Using user’s address most compelling thought since each user will have at least one geographic address. Address alone is not sufficient for calculation of distance we need to convert it to latitude, longitude pair which is an overhead.

    The Best option will be to use options 2,3.4 together, You can do that in two steps:-

    1. First determine the latitude, longitude from the address.
    2. Then use this lat, long value for further processing i.e. storing in database etc.

    For various options available for this see the answer of this question

提交回复
热议问题