5

We have a problem with the Facebook jsssdk in the way it loads the iframes. Our app is bundled with stbuild into an iOS app (besides being served over http as a mobiel web page).

In "iOS mode", the origin of your app is file:///[...]/index.html. The Facebook scheme-less url style is breaking for us, because //connect.facebook.net/en_US/all.js translates to file:///connect.... Therefore, we updated our snippet to:

(function(d, s, id, debug){
   var js, fjs = d.getElementsByTagName(s)[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement(s); js.id = id;
   js.src = "//connect.facebook.net/" + bp.lib.Facebook.getCurrentLocale() + "/all" + (debug ? "/debug" : "") + ".js";
   fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk', /*debug*/ false));

However, the facebook sdk will create iframes for the individual like buttons. These also have an <iframe src="//..." >, and break. I didn't find a way to enforce the sdk to use url schemes.

Does anyone have an idea? Thanks

3
  • 1
    As a “quick fix” you could generate the iframe code yourself … (if you don’t need to listen for edge.create events).
    – CBroe
    Apr 15, 2013 at 10:11
  • +1, just use the iframe version of the plugin yourself?
    – Igy
    Apr 15, 2013 at 14:56
  • We don't need to listen to any events. However, I would prefer to use the SDK anyways, because it will be easier to integrate as we dynamically add like buttons to the view. I'd suggest you formulate this as your answer, and if there is no way to set the URL scheme to use with the JS SDK I will accept it. Apr 17, 2013 at 10:57

1 Answer 1

0

You can just use https:// in all the iframe code and other files you include on your web page. It will then still work correctly over a regular http connection and with https connections. It's the best way to prevent issues like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.