HTML5 Geolocation

91 views
Skip to first unread message

Aymen Jaouadi

unread,
Sep 10, 2015, 10:23:13 AM9/10/15
to CefSharp
Hi,

I want to implement the control CefSharp ChromiumWebBrowser in a WPF application of geolocation. I'm using the HTML5 geolocation:

        function getLocation()
    {
        if (window.geolocation) {
            navigator.geolocation.getCurrentPosition(showPosition, showError, { enableHighAccuracy: false });
        } else {
            alert("Geolocation is not supported by this browser.");
        }

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

        function showError(error) {
            switch (error.code) {
                case error.PERMISSION_DENIED:
                    alert("User denied the request for Geolocation.");
                    break;
                case error.POSITION_UNAVAILABLE:
                    alert("Location information is unavailable.");
                    break;
                case error.TIMEOUT:
                    alert("The request to get user location timed out.");
                    break;
                case error.UNKNOWN_ERROR:
                    alert("An unknown error occurred.");
                    break;
            }
        }
    }
 
I have always the same answer by using the function getLocation "Location information is unavailable.".
Can any one help me please.

Thank you in advance,
Aymen

Alex Maitland

unread,
Sep 10, 2015, 6:44:29 PM9/10/15
to CefSharp
Reply all
Reply to author
Forward
0 new messages