0

I'm trying to load a page like this example, below, in a TChromium, but when I click the component don't show dialog asking to allow my geolocation, does have TChromium support do geolocation? By the way, TWebBrowser says that don't have support when I use the component.

<!DOCTYPE html>
<html>
<body>
<p>Click here to get the coordinates</p>

<button onclick="getLocation()">Click</button>

<p id="demo"></p>

<script>
var x = document.getElementById("demo");

function getLocation() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition, showError);
    } else { 
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}

function showPosition(position) {
    x.innerHTML = "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude;  
}

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>

</body>
</html>
Artur_Indio
  • 736
  • 18
  • 35
  • Are you ready to get Google Geocoding API key ? If so, or you have one, [`set it up`](http://www.chromium.org/developers/how-tos/api-keys) for Chromium. And then execute `Result := True; callback.Cont(True);` in the `OnRequestGeolocationPermission` event handler to grant permissions for geolocating (depending on the request). I'm saying so, because I'm not sure if there's a way to go without Google here (there seems to be no way to set geolocation by yourself). Oh, and geolocating seems to be blocked for local scripts. – TLama Jun 12 '15 at 08:43
  • @TLama thanks, I will check and give a feedback, specially for local scripts. – Artur_Indio Jun 17 '15 at 07:36
  • @TLama I still getting the message in google maps "is not possible get the location", I can't set `Result := True` in the `OnRequestGeolocationPermission`. – Artur_Indio Jul 07 '15 at 23:07
  • Which version of DCEF do you use ? – TLama Jul 08 '15 at 00:20
  • dcef-r306 in this [link](https://code.google.com/p/delphichromiumembedded/downloads/detail?name=dcef-r306.7z) – Artur_Indio Jul 08 '15 at 02:55

0 Answers0