10

i'm having troubles at creating a FB.ui send dialog box when my web app is running on iPhone. Here's the code snippet, in javascript:

    if(navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPhone/i)){
        window.top.location = "http://m.facebook.com/dialog/send?app_id=<<My_App_Id>>&link=<<The_Link>>&redirect_uri=<<The_Url>>&to=<<User_Id>>";
    } else{
        FB.ui({method: 'send',
            link: "<<The_Link>>",
            picture: picture,
            description: description,
            to: User_Id
        });
    }

It works nice when i use any browser on windows, works nice using Safari on iPad too. But when i try to open a dialog box to send a message on iPhone, i see the following error messsages:

This dialog is not available on this device. API Error Code: 4202 API Error Description: This dialog cannot be displayed on this device Error Message: This method isn't supported for this display type

I've already had this error messages when I called FB.ui({}) method on iPad and, therefore, I created that if statement for treating this situation on iPad. But this workaround didn't work for iPhone.

Somebody can help me?

msantos
  • 101
  • 1
  • 4

3 Answers3

6

This dialog can be used with the JavaScript SDK and by performing a full redirect to a URL. It is not supported on mobile devices. https://developers.facebook.com/docs/reference/dialogs/send/

zurg
  • 61
  • 1
  • 2
  • 1
    in some cases, you might want to use this https://developers.facebook.com/docs/plugins/send-button as a temporary solution :( – Goon Nguyen Nov 11 '16 at 07:20
  • 1
    @GoonNguyen You should totally post that as an actual answer to this question — certainly the [Send Button](https://developers.facebook.com/docs/plugins/send-button) will serve my purposes and I just tested it successfully on my phone. Ping me if you do submit that as an answer so I can come upvote you :) – Owen Blacker Mar 23 '17 at 15:16
  • 1
    Thanks @OwenBlacker, I've just reposted it ! – Goon Nguyen Mar 27 '17 at 15:30
1

(Just repost this one as an answer)

In some cases, you might want to use this https://developers.facebook.com/docs/plugins/send-button as a temporary solution.

Unfortunately you can't change the interface of this button.

Goon Nguyen
  • 1,462
  • 11
  • 26
  • 1
    Thanks Goon Nguyen, that's exactly what I was looking for :) – Owen Blacker Mar 28 '17 at 17:14
  • 1
    "With the release of Graph API version 2.11, the Send Button is deprecated. For Graph API versions 2.10 and under, the Send Button will be supported until February 5, 2018." – mb21 Mar 29 '18 at 13:15
0

Facebook clearly mentions that "It is not supported on mobile devices." Here is the link to their article: enter link description here

You need another way to fix it. Even the send button is now no more supported in Facebook API.

Community
  • 1
  • 1
Rishabh
  • 39
  • 7