Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Web Player in a Facebook Canvas iFrame

Discussion in 'Editor & General Support' started by Kevpearman, Jan 31, 2012.

  1. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    I developed an iphone game that i would like to port over to facebook via the webplayer. The game works in the webplayer fine on my website but i can't get it to run in a facebook canvas.

    There's a lot of posts talking about this but most of them are out of date, since October 2011 facebook canvas's requrie you to use HTTPS rather than HTTP. I have created a folder that is accesible via https on my web server but i get warnings about none secure content when i navigate to it in a browser. I'm assuming this is the javascript used to load and track the unity player object, unityobject.js

    Has anyone here got a unity project running on a facebook canvas that can perhaps point me in the right direction? Can i just use the basic webplayer.html created when building a webplayer project or do i need to modify it to satisfy the https requirements? If so, does anyone have an example i can use?

    Cheers

    Kev
     
  2. Kevpearman

    Kevpearman

    Joined:
    Dec 9, 2009
    Posts:
    44
    Well the problem currently doesn't appear to be unity related. I created a html file with just some text in it and that won't display either, but I signed up for a cloud app using the recommended facebook partner and that displays in the canvas fine. I guess it's something ot do with my hosting provider
     
  3. ArturoNereu

    ArturoNereu

    Joined:
    Aug 23, 2012
    Posts:
    10
    Hello,

    Sorry for answering months later but this may come useful to someone someday.

    I encountered this problem using Facebook and a SSL enabled hosting. The thing is that chrome blocks the petition for the UnityObject.js from the unity site because it is not "safe".

    So, the workaround here is to make your own UnityObject.js file and store it along with the rest of your web files.

    The script is located (On a PC):

    C:\Program Files (x86)\Unity\Editor\Data\Resources\UnityObject.js

    Now, on your PHP or HTML file include this script and things should work now.

    Greetings.