Link to home
Start Free TrialLog in
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
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

PC's don't have a gps chip.
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.
Avatar of Tamilarasu P
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)
what are the solution for access location in PC via google chrome,safari,mozilla,etc..
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

This script does not work Mr.David
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/
Longitude & latitude function only has been working.Does not point out GPS Track
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?
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Then how solve my issue?