How can I pass parameter through URL to Facebook instant game app?

612 views Asked by At

My facebook instant game app which have following url: https://www.facebook.com/instantgames/279246242904501/

When I hit the above game URL, Facebook website load the actual game inside iframe. I just want to pass URL parameter to my game app which I could receive using JavaScript inside my game code.

Can this be possible?

1

There are 1 answers

0
Chris Hawkins On

You can use link contexts. This is a currently undocumented feature, but if you navigate to fb.gg/play/{your_game}/{ref} you will end up in a unique context based on the value of ref. You can then use context.getID() to determine which context you are in.

Note, this can't be used to pass arbitrary date into the game because there's no way to read the string value of ref. There is currently no mechanism by which it is possible to do that.