I've been trying to fix this issue for hours without success. I hope to get a geolocation api genie to answer here. It's very simple, I'm just trying to get the api to ask for my position and then disclose it. It works well in Chrome, I get prompted and asked to disclose my location and then I can see my coordinates just fine.
With Firefox, however, when I look in the console this is what I see when I click on the button
RPC: got message Array(3) [ {…}, {…}, () ]common.js:341:15
What does this mean and how do I fix this?
This is my code :
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
alert("Geolocation is not supported by your browser. Please update your browser. Visit Help Center.");
}
}
function showPosition(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
alert(latitude);
}
By the way, I tried running the code in W3Schools in Firefox and it's working fine on their server. When I try run it in localhost, receive the RPC message in the console.
I figured it out. For me, the problem came from one of the Firefox extension and preventing the Geolocation Api from disclosing location data.
Make sure you disable all your add-ons if you debug with Firefox...