8

I have a website which uses HTML5 geolocation. It works very well except through the Android Facebook in-app browser. This is the internal app browser that opens when a link is clicked in the Facebook app.

Normally when accessing the page a user would get a use location prompt (Allow / Block) but in the Facebook app nothing is requested and the page/site doesn't have location access.

Does anybody, for the love of all that's holy, know a solution to this or even a way around it?

I'm kind of at my wit's end here as I do not have a valid solution other than recognising that the user is in the Facebook browser and asking them to break out via the 'Open in Chrome' menu setting.

Thanks in advance

Adam
  • 81
  • 4

3 Answers3

2

I'm pretty sure that the Facebook in-app browser doesn't implement the HTML5 geolocation API on purpose because that would be a very easy way for somebody to phish out people's location since a lot of people already allow location for their Facebook app.

ds-bos-msk
  • 780
  • 9
  • 13
0

With geolocation i don't think you can avoid the prompt of 'allow/block'. That would cause security risks.

Back-end should return you the IP address. Check How to get ip address using javascript or jQuery?

Community
  • 1
  • 1
DrNio
  • 1,936
  • 1
  • 19
  • 25
0

EDIT: SOLVED

I know this is an old post, but I would like a fallback when a user visits a site that uses geolocation on the facebook app.

I have the folowing check, but that doesn't seem to work:

if ('geolocation' in navigator){
    //HANDLE GEOLOCATION
} else {
    detour();
}

Is there another check I can use the add a special case for facebook visitors?

UPDATE: Just use:

if (navigator.gelocation) {...}