Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

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!"); } }

글쓴이 Andrew 수정일시

선택된 해결법

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.

문맥에 따라 이 답변을 읽어주세요 👍 0

모든 댓글 (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?

글쓴이 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

선택된 해결법

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.