Facebook Canvas and WebGL problem
I have a problem with facebook canvas and web gl...
If i go directly to the address of the game hosted in my google drive herE: https://b1754d066320e56286ea139f5db4fa41b2d2c00d.googledrive.com/host/0B6aEHRQAY6txfmVSMkM1M2NST0QtT3Y2cjZEZVA3Q2dEeFFPS05qUG9MeUw1ZUFxLUR4LVU/
everything plays fine (the game is around 300mb), if i post the link from my game to facebook canvas and hit publish and then go to the facebook address of my game , i just see a white screen...
Is there a size limit for facebook canvas?? and if so is there a way to decrease the size of the game in webgl?? if i just exprot for web its just 40mb (and it makes sense because the game is not that big)
any help would be much appreciated
Answer by zzzzzz789 · Nov 09, 2015 at 09:23 PM
There is no size limit for Facebook Canvas, the issue your are experiencing is due to the configuration of the web hosting you are using for your game.
Facebook uses POST to request data to fill the Canvas iframe. Google Drive hosting adds 'X-Frame-Options' to 'SAMEORIGIN' when issued a HTTP POST. This is why you get the error below in the console when trying to use Google Drive for hosting on Facebook.com.
To solve this, try using another hosting solution. One place to get started is Heroku, which offers free hosting and supports HTTP POST requests.
Hello again!! is there any guide on how to upload and host my web gl app on heroku??? because the link you gave me doesn't help much... should i first upload it to github?
Start on the heroku dash, create application, create app, follow directions for the Heroku Toolbelt to setup your project. The easiest quick way for heroku to recognize your application as a php app for hosting is to just rename index.html to index.php, then run the git push heroku master
to deploy!
You could also create a hacky alias to have this automated like so: alias gphm_unity='pushd PATH/TO/BUILD;mv -f index.html index.php;git init;git add --all;git commit -m "deploy";git push git@heroku.com:YOURAPPNA$$anonymous$$$$anonymous$$git -f master;rm -fr .git;popd'
I followed these instructions https://discussion.heroku.com/t/push-rejected-no-cedar-supported-app-detected/640 and i finally got to upload it
However when i go to the address of my app here http://shadowhunters.herokuapp.com I get instant loading and no game!! How can I see inside my repository to check if all the files were uploaded?
Ok so after a lot of searching and testing a few sites I ended up with amazon's aws. So i managed to host my game with https at shadowhunters.s3.amazonaws.com/index.html It runs perfect just like google drive. However, when I put it on facebook I get the following error:
PreconditionFailedAt least one of the pre-conditions you specified did not holdBucket POST must be of the enclosure-type multipart/form-data09E91DA867B8093BBnyza7TdztBAJhoNk9m2I9ZjL9D3dtPetoqJ8/3zGR93Izr28oq+CX34avwRFfRdrl2w0uqayQ8=
Hi @xjimdim, unfortunately S3 hosting has similar issues to google drive, they do not fully support content loading via HTTP POST as Facebook requires for Canvas applications. see: http://blog.svnlabs.com/amazon-s3-facebook-fanpage-app/
If you move to using an EC2 instance on AWS you will have to obtain a SSL certificate for your domain. I encourage you return and try heroku to begin with simple hosting.
Your answer
Follow this Question
Related Questions
Didn't loading facebook instant game 0 Answers
WebGL. UI raycast targets don't get rotated when rotating html-container with css. 0 Answers
web gl facebook multiplayer 0 Answers
WebGL Facebook SDK Login 0 Answers
Facebook SDK does not return focus to game canvas after FB purchase popup closed 0 Answers