Getting current location in google map and pass it to a variable in javascript

前端 未结 2 2062
借酒劲吻你
借酒劲吻你 2021-01-29 10:17

I want to display a direction in google map from current location to a known location. my code is shown below:

      

        
2条回答
  •  情话喂你
    2021-01-29 10:37

    There could be 3 reasons:

    1. Your browser doesn't support geolocation.
    2. You have disabled geolocation tracking. In google chrome you can enable it looking in options, searching location in your settings.
    3. If you are working on a HTML file on your pc directly as file:/// geolocation is disabled for security reasons.

提交回复
热议问题