Jump to content

How to post player´s score on Facebook (with js)


totallybueno
 Share

Recommended Posts

Hi there,

I have my game made with Phaser (and compiled with cocoon.io) and on the leadersboard state I want to let the user to post his score on Facebook.

 

Well, I created an App on Facebook and I´m not finding a good solution to create this simple post, something like "I scored 10 points on this riduculous game..." Pretty easy on Twitter and not so easy on Facebook, I can find information about posting links and that stuff but I´m not finding a proper way to create a simple post just with text.

 

How do you guys do this? I guess I´m missing something, it shouldn´t be so complicated.

 

 

Cheers, Jorge.

Link to comment
Share on other sites

Short answer: if you are looking for a simple method, then it is not possible.

 

The one simple thing you can do, is use the deprecated sharer.php. This lets you share a link, but it doesn't let you specify what default text should go in the link description. It used to be possible to do that, but no more.

'https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent('http://www.mywebsite.com');

But like I said, sharer.php is now deprecated and unsupported / undocumented. The way to do these things now is through the Feed Dialog interface.

 

But to do that, you need to use the Facebook JavaScript SDK and/or have your app registered as a Facebook app, and therefore you need to be prepared to enter a world of pain and misery, where things that work today will no longer work tomorrow and require periodical complete rewrites.

 

Also this paragraph from the documentation of Feed Dialog is worth noting:

 

If a person has the "Who can post on your timeline?" setting set to "Only me" and another person tries to make a post to the first person's timeline using the Feed dialog, it will display a "Cannot post" error.

Link to comment
Share on other sites

Thanks guys, I tried the plugin that icp said and it´s awesome, works ever better than expected, a treasure! Thanks mate, seriously, I do love this :)

 

Now I only have a tiny problem and it´s with the desktop version of the game on Facebook... The docs really suck and even the whole ecosystem stinks... I think that for this case I´m gonna use a normal window.open to a Facebook page and that´s all, I shouldn´t be so "complicated" to post something on Facebook... see you another day Zuckerber.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...