views:

377

answers:

0

I am trying to make it easy for users of our site to deploy widgets hosted on our server on their facebook pages, as an iframe.

We don't want to use coz apparently they are not allowed and wont be supported in the future [ http://is.gd/aNhUr ]

Following the instructions here ( http://is.gd/aNgIU ), this is what we did :

a) We created an application with i) Canvas Settings: * canvas page url : http://apps.facebook.com/{app-name}/ * canvas url : http://{my-server}/fb/ * render method: FBML ii) Profile Settings:
* Tab Name : {tab_name} * Tab Url: http://apps.facebook.com/{app-name}/{app-name}?wid={unique_identifier}

b) Created a facebook page and added the application to the page.

c) and index.php under "fb" folder in our web server docroot is as follows:

<?php
    echo '<a onClick="outside_location.setInnerFBML(link_1);console.log(link_1)" style="cursor: pointer;">Let\'s see the iframe here</a>';
    echo '<div id="outside_location"></div>';
    echo '<fb:js-string var="link_1">';
    $wid = $_GET['wid'];
    echo "<iframe height='500' allowTransparency='true' frameborder='0' scrolling='no' style='width:100%; border:none' src='http://&lt;some_domain&gt;/$wid' >";
    echo '</iframe>';
    echo '</fb:js-string>';
    echo '<script type="text/javascript" charset="utf-8">
    var outside_location = document.getElementById("outside_location");
    </script>';
?>

The above steps work. But we want to make it easier to do this. Right now, our users have to go through this tedious process of creating a facebook application and add it to the facebook page, just for putting their widget on their facebook pages. Is there a way to use some facebook api to automate this or reduce the number of steps involved ?

Every widget we provide to the user, has a unique id and url. So, when a user creates a new widget on our site, we want to be able to tell the user some quick and easy steps to be able to add the widget to their facebook page OR completely automate the whole process if possible.