0

I have a simple function to get the users location and search it in google maps. Works fine on Chrome desktop safari mozilla mobile and web but this does not work on chrome mobile. I have seen posts like this post that say it only works on https but as you can see below I am using a https url and my website is https.

function getLocation(Title) {
     var startPos;
      navigator.geolocation.getCurrentPosition(function(position) {
    startPos = position;
  window.open('https://www.google.com/maps/search/'+Title+'/@' + startPos.coords.latitude+','+startPos.coords.longitude);    
  });
}

I have tried this

function getLocation(Title) {
     var startPos;
      navigator.geolocation.getCurrentPosition(function(position) {
    startPos = position;
  alert(startPos.coords.longitude);    
  });
}

to attempt to debug the issue but I cannot get any response on chrome on mobile. It seems to be only on mobile chrome. I am using the Pixel phone to test this if that makes any difference. Please help me I am out of ideas.

0 Answers0