Avatar of Tamilarasu P
Tamilarasu P
 asked on

Locaton couldnot be determined in google chrome

Hi,

  Google chrome GPS location could not be determined.Some times works fine.otherwise not working.Please suggest me any other for access location in google chrome browser.We want goole chrome browser access gps location.

  Every day we are facing this issue in our PC's.Work fine in LAptop & mobile chrome browsers
GoogleChromeGIS/GPS Programming* GeolocationWeb Browsers

Avatar of undefined
Last Comment
Tamilarasu P

8/22/2022 - Mon
David Johnson, CD

PC's don't have a gps chip.
dbrunton

I think he means Geolocation rather than GPS.

If he means Geolocation then there a couple of possibles.  The browser doesn't have a https connection or it is not permitting that information to be sent back.
Tamilarasu P

ASKER
i know no chip in pc.But safari browser works fine.And google chrome also work fine after 1 PM (GMT +05.30)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Tamilarasu P

ASKER
what are the solution for access location in PC via google chrome,safari,mozilla,etc..
David Johnson, CD

HTML 5 Geolocation
<script>
var x = document.getElementById("demo");
function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}
function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude; 
}
</script>

Open in new window

function showPosition(position)
  {
  lat=position.coords.latitude;
  lon=position.coords.longitude;
  latlon=new google.maps.LatLng(lat, lon)
  mapholder=document.getElementById('mapholder')
  mapholder.style.height='250px';
  mapholder.style.width='100%';

  var myOptions={
  center:latlon,zoom:14,
  mapTypeId:google.maps.MapTypeId.ROADMAP,
  mapTypeControl:false,
  navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}
  };
  var map=new google.maps.Map(document.getElementById("mapholder"),myOptions);
  var marker=new google.maps.Marker({position:latlon,map:map,title:"You are here!"});
  }

function showError(error)
  {
  switch(error.code) 
    {
    case error.PERMISSION_DENIED:
      x.innerHTML="User denied the request for Geolocation."
      break;
    case error.POSITION_UNAVAILABLE:
      x.innerHTML="Location information is unavailable."
      break;
    case error.TIMEOUT:
      x.innerHTML="The request to get user location timed out."
      break;
    case error.UNKNOWN_ERROR:
      x.innerHTML="An unknown error occurred."
      break;
    }
  }
</script>

Open in new window

Tamilarasu P

ASKER
This script does not work Mr.David
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
David Johnson, CD

you have to call the function
<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Geolocation Test</title>
     </head>
    <body>
        <p>Click on the Button to get your coordinates.</p>
        <button onclick="getLocation()">Try it</button>
        <p id="demo"></p>

<script>
var x = document.getElementById("demo");
function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}
function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude; 
}
</script>  
    </body>
</html>

Open in new window

http://ee29009446.azurewebsites.net/
https://jsfiddle.net/dwj7738/c7zxtm6e/3/
Tamilarasu P

ASKER
Longitude & latitude function only has been working.Does not point out GPS Track
Tamilarasu P

ASKER
After 12.30 PM working fine in google chrome.Before 12.30 PM not working.You have any google chrome support team contact number r email id?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
David Johnson, CD

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tamilarasu P

ASKER
Then how solve my issue?