Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Location services in Firefox iOS

more options

I am a web developer for a state agency and was having a bit of an issue with getting Firefox for iOS to work with our current get location code. Most of the other browsers work with the following, including Firefox desktop and Firefox Mobile.

Is there something different about iOS that I am missing. On the JS fiddle the console.log runs, but it just stops after that.

Any help would be appreciated? or being able to access the console.log in the iOS browser as well?

Thank you, Peter Ottenbacher [email]

function Geolocate() {

       console.log("getting location");
       //check if the geolocation object is supported, if so get position
       if (navigator.geolocation) {
           navigator.geolocation.getCurrentPosition(displayLocation, displayError);                
    
       } else {
           alert("Sorry - your browser doesn't support geolocation!");
       }
   }
I am a web developer for a state agency and was having a bit of an issue with getting Firefox for iOS to work with our current get location code. Most of the other browsers work with the following, including Firefox desktop and Firefox Mobile. Is there something different about iOS that I am missing. On the JS fiddle the console.log runs, but it just stops after that. Any help would be appreciated? or being able to access the console.log in the iOS browser as well? Thank you, Peter Ottenbacher [email] function Geolocate() { console.log("getting location"); //check if the geolocation object is supported, if so get position if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(displayLocation, displayError); } else { alert("Sorry - your browser doesn't support geolocation!"); } }

Izmjenjeno od strane Andrew

Izabrano rješenje

Ha ha figured it out. Cleared cookies in Firefox on iPhone and it worked. Weird note: alert(platform.name) returned Safari and Firefox for iOS at different intervals.

Thank you for the trouble shooting help cor-el.

Pročitajte ovaj odgovor sa objašnjenjem 👍 0

All Replies (5)

more options

Maybe try to add try{}catch(error){} code ?

more options

Does it not work with location service is really my main question? There isn't much anything online saying it does or doesn't.

There us a try/catch situation further in the code, but doesn't seem to get that far.

The site asks for permission, as I have checked in settings, then I say "this time" and it seems to load, but no magic. Is there a way to get to the console.log in the phone for Firefox?

Izmjenjeno od strane peter.ottenbacher.tdem

more options

I do not have an iOS phone, does something like this work?

navigator.geolocation.getCurrentPosition(function(loc){
 alert('Your current position is:\nLatitude: '+loc.coords.latitude+'\nLongitude: '+loc.coords.longitude+'More or less: '+loc.coords.accuracy+' meters');
},function(err){alert(JSON.stringify(err))});

more options

I will try today, thank you for the info. I was also going to try this one that I found

if ('geolocation' in navigator) {

                   alert("'geolocation' in navigator")
               } else {
                   /* geolocation IS NOT available */
                   alert("geolocation IS NOT available")
               }

I will let you know if either work.

I found this too yesterday and it doesnt seem like it will work in Firefox for iOS. I just need to confirm or if there is a workaround....

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation

more options

Odabrano rješenje

Ha ha figured it out. Cleared cookies in Firefox on iPhone and it worked. Weird note: alert(platform.name) returned Safari and Firefox for iOS at different intervals.

Thank you for the trouble shooting help cor-el.