Facebook iframe self hosted app not displayed - facebook

I am currently integrating a HTML5 app into Facebook and testing the iFrame mechanism. I am self-hosting the game content however when I point the Facebook app system to the content, the page is not being displayed.
My hosted page is a simple Hello World app for now as illustrated below, and can be found at: https://bluebeck.space/alienz/fb/
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<title>Alienz</title>
</head>
<body>
<div><p>Hello, World!</p></div>
</body>
</html>
The app configuration in the Facebook app developer console appears as:
I have used the following HTTPS url which has a valid SSL certificate as required:
The app page contents are empty and upon inspection of the Facebook app page DOM, it is apparent that the iframe contents have been stripped from the hosted page:
My expected result would be that the contents of the self-hosted webpage would be visible in the Facebook app page. The actual result is that the contents are empty and the DOM contains an iframe tag with empty head and body tags.

Thanks to #cbroe I was able to pin this down to an X-Frame-Options error. My solution has been to include the following php headers to the page:
<?php
header('X-Frame-Options: ALLOW-FROM https://apps.facebook.com/');
header('Content-Security-Policy: frame-ancestors https://apps.facebook.com/');
?>

Related

Facebook link preview for redirects

link A >> 301 >> link B
The Facebook link preview displays data from link A. I want it to display data from link B.
How can I fix this?
I used this code for the redirect.
<!DOCTYPE html>
<html lang="en">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>
<body>
<script type="text/javascript">
window.location.replace("http://www.yahoo.com");
</script>
</body>
</html>
Thank you
In general Facebook should be following the redirects because the users will be redirected and facebook does not want to present unexpected results causing disruptive experience.
Since 301 is permanent redirect you could also use the final URL, I presume.
Also, take a look at https://developers.facebook.com/tools/debug/ - enter the URL and it will display what facebook crawler is doing.

Youtube video not visible in facebook tab

I am experiencing trouble in Facebook brand tab, for my client's Facebook page.
I have created a tab inside Facebook Page.
I have HTML code for the same.
In this code i have used iframe to showcase video from Youtube.
When i open this html file with google chrome from my desktop entire design of 810 x 800px is visible with 'youtube video' and video gets played.
but the moment I create a new tab inside Facebook page, give my app id and url only background image is visible and no video!
All my content comes from SSL certified site.
Here is the code i am using.
enter code here
<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Kich Video</title>
<style type="text/css">
body {
margin:0;
background-color:#f0f0f0;
}
#container {
width:810px;
height:695px;
padding-top:115px;
padding-left:260px;
margin:0px;
background-image:url(https://spotlightcommunication.com/work/kichtvad/background.jpg);
background-repeat:no-repeat;
}
#container object {
width:560px;
height:315px;
}
</style>
</head>
<body style="margin:0">
<div id="container">
<iframe width="500" height="281" src="http://www.youtube.com/embed/4CjayX3GNmU?rel=0"
frameborder="0" allowfullscreen></iframe>
</div>
<div style="padding-left:0px;">
<a href="http://www.crowdmultiplier.com"><img
src="http://i1160.photobucket.com/albums/q495/chandansolanki/CMPowered810x60_Px.jpg"></a></div>
</body>
</html>
I have currently keep this tab alive on Facebook page.
there you can see, only background image is visible and not video.
Facebook page link Facebook.
Tab marked as Kich TV Ad needs to show this video.
Can anyone help me on this?
Kirit JAsani
All my content comes from SSL certified site.
Well, you always need to use https. If you take a look in the Browser console, it will tell you that the youtube link got blocked because it´s unsafe content (http instead of https). Use https for ALL absolute URLs. That goes for the youtube src and for the photobucket src.

Embedded Youtube video won't play in Facebook app

I'm working on a simple FB app of a type I've done many times before. It works perfectly outside FB but once it's in FB, the youtube embed simply doesn't load.
I pulled the code out into a test file, and it still won't load. Here's the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
</head>
<body>
<iframe width="669" height="391" src="http://www.youtube.com/embed/48P1jc5tyTw" frameborder="0" allowfullscreen></iframe>
</body>
Absolutely nothing displays when this is loaded as an app on a FB page. The FB debugger says "Can't Download Could not retrieve data from URL."
Any ideas?
Try changing the src of the iframe to "https://...".
Since Facebook is served over HTTPS, your browser will block any content from loading on the page that's not over HTTPS too. Fortunately, youtube supports https versions of their URLs.

Sync Facebook user data between frontend and backend

This question is of type: What is your suggestion? If it does not respect SO guideline, I am sorry.
I am developing a RESTful application that will be available in Facebook Pages. The backend is developed in PHP using CodeIgniter with RESTful library for it.
The frontend is developed using BrunchIO in CoffeeScript.
The starting point of the application is home.php, a CodeIgniter controller, which loads a view looking like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>fBoutik - Shop</title>
<meta name="viewport" content="width=device-width">
<script>
require('initialise');
</script>
</head>
<body>
</body>
</html>
(Left out other data).
When initialise file is loaded, some stuff is executed. including initialising a User Marionette (Backbone) model.
A users logs in with Facebook on the frontend and a POST is made to the server to a controller, where I set some data on SESSION.
This is a little cumbersome, because every time the app is loaded, the Facebook login dialog appears (which goes away in a moment) and a POST is made on the server.
Is there a better way to sync the user data between frontend and backend ?
If you need more details, I'll update this post.

Facebook Like Button on iFrame-based FB Pages App - Problem

I'm experiencing problems adding a like button to an iFrame based page within my FB fan pages tabs. I'm using the JavaScript SDK and the Open Graph to specify the page I'd like the user to "like" (which is the current page within my FB pages).
The page is iFrame based, is an app in FB, and is accessed via the FB Page tabs of my FB Page. The problem is that Facebook is assigning the Like to my FB Page itself (my FB page homepage if you will) rather than the page In question (my test page – it’s set up as an app and appears in my FB Pages tabs under the name “og test”).
I’ve tried running the target page for the iFrame through the FB linter and its giving a strange error saying I’ve supplied the Open Graph Type of “Other” (I haven’t, I’ve supplied “website” in my META tag) see below:
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.airport-parking-quote.co.uk%2Ffacebook%2Fog-test.php
Also, from looking at the debug page it seems that Facebook is either ignoring the QueryString in my “og:url” value and therefore only seeing my FB page’s vanity URL, or there is some kind of block on being able to Like iFrame based app pages.
Can anyone shed any light on this? I thought from this article it would be possible to achieve what I am trying to do:
http://www.insidefacebook.com/2010/09/09/like-buttons-app-content/
The code for the iFrame target page is:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Test Like</title>
<meta property="og:title" content="OG Test"/>
<meta property="og:type" content="website"/>
<meta property="og:url" content="https://www.facebook.com/EssentialTravel?sk=app_275969292428556"/>
<meta property="og:image" content=""/>
<meta property="og:site_name" content=""/>
<meta property="fb:admins" content="100002424161307"/>
<meta property="fb:app_id" content="275969292428556"/>
<meta property="og:description" content="OG test through canvas page"/>
</head>
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId : '275969292428556',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true // enable OAuth 2.0
});
</script>
Test Page<br>
<script src="http://connect.facebook.net/en_US/all.js#appId=156081301143077&xfbml=1"></script><fb:like href="https://www.facebook.com/EssentialTravel?sk=app_275969292428556" send="false" width="450" show_faces="false" action="recommend" font=""></fb:like>
</body>
</html>
Anybody have any ideas?
Thanks,
Pjordanna
Unfortunately you can't set up a like button for an actual tab on a page.
As you have found out, trying to make a like button using a url such as https://www.facebook.com/EssentialTravel?sk=app_275969292428556 will just make a like button for the page not the individual tab.
The best way to make a like button for that specific tab would be to just use the URL of the app sitting on your server eg. http://YOURDOMAIN.com/YourAppDirectory