FB.ui send dialog box not working on iPhone

8.1k views Asked by At

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?

3

There are 3 answers

3
zurg On

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/

0
Rishabh On

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.

2
Goon Nguyen On

(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.