Find current location by using html in iphone

前端 未结 1 925
我在风中等你
我在风中等你 2020-12-10 19:46

when i send email which contain destination address when user will click on that address he should get directions from his current location to destination address on google

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 20:06

    You can get the location in Javascript.

    The api is based on this spec.

    And here's a running sample.

    Some code extract:

    function findLocation() {
        navigator.geolocation.getCurrentPosition(foundCallback, errorCallback, {enableHighAccuracy:true,maximumAge:600000});
    }
    

    0 讨论(0)
提交回复
热议问题