Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <script src="https://www.googleapis.com/geolocation/v1/geolocate?key=TWOJKLUCZ&sensor=true&libraries=places,weather" async defer>
  2. </script>
  3.  
  4. <script>
  5. window.onload=getMyLocation();
  6.  
  7. function getMyLocation(){
  8. if(navigator.geolocation){
  9. navigator.geolocation.getCurrentPosition(displayLocation);
  10. }else {
  11. alert("cos nie bagla");
  12. }
  13. }
  14.  
  15. function displayLocation(position){
  16. alert(position.coords.longitude);
  17. }
  18. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement