How does Facebook find out whether it's mobile device or not?

143 Views Asked by At

I've run myself into a problem while implementing FB Pay dialog for external site.

For displaying this dialog, I use FB.ui method according to the documentation:

https://developers.facebook.com/docs/reference/dialogs/pay/

But the Url generated by JS contains display=popup parameter, which works on mobile devices only. It's not my case: I need the payments to work on both mobiles and desktops.

So, I decided to use the JS FB.ui method for mobiles and simple GET Url for desktops.

Here are the questions:

1) Is it correct decision or is there a better way to make the FB Pay dialog work on both mobiles and desktops?

2) If it's the best way, how can I find out whether it's mobile device or not? Internally, in our site we just use the list of mobile user agents for guessing, but it's not necessarily the FB way. So, what's the FB way?

0

There are 0 best solutions below