Facebook IFRAME Application Issues : PART-1

While I switch one of my fb application  from FBML to iframe , I have faced some silly problem. But to solve those problems , I have to waste so many hours. After searching the forum, asking mates and friends and then find out the solution.  I am thinking Mahedi hasan to help me a lot. When I got the solution I found that it’s a very 1 or 2 min jobs.   I have found mostly these problem arise in the beginning of application and basic issues. I hope so you will share your iframe problem too .

Here are the problems that I have faced  while developing an iframe application:

1. POST Submission problem :

http://forum.developers.facebook.com/viewtopic.php?id=24430

While I submit the post data unfortunately I  do not get any post data. I have found that post field is empty. I am very surprised how my $_POST field is empty though it submit the action page.   I have given a sample form of my application.

Posting it via the server url:


<form action="http://myserver.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>
</form>


Posting it via the app callback url:



<form action="http://app.facebook.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="submit" name="Submit"/>
</form>


After search in  facebook developer wiki,forum and blog , I have known that

while submit the form , iframe lost the session key as there is no session key passed . As a result it lost user id and lost all the post data. That’s why i have to set user_id. So below is the forum post link :

http://forum.developers.facebook.com/viewtopic.php?id=22929

And  here Is how I solve this issue . This my modified form where I added two  hidden fields. One is fb_sig_session_key and another one is user_id.

Posting via fb_sig_session_key and user_id

<form action="http://myserver.com/appname" method="POST">
<input type="text" name="test1"></input>
<input type="hidden" name="fb_sig_session_key" value=”<?php $_GET[‘fb_sig_session_key’]”></input>
<input type="hidden" name="user_id" value=”<?php $_GET[‘user_id’]”></input>
<input type="submit" name="Submit"/>
</form>

So after submit the form here I show how can I set_user and now find the post values.

</pre>
<?php

if (isset ( $_REQUEST ['kb_fb_sig_session_key'] )) {

$this->fb_sig_session_key = $_REQUEST ['fb_sig_session_key'];

}

if (isset ( $_REQUEST ['user_id'] )) {

$this->uid = $_REQUEST ['user_id'];

}

if ($this->uid != '') {

$this->facebook->set_user ($this->uid, $this->kb_fb_sig_session_key );

}

$this->facebook->set_user ($this->uid, $this->fb_sig_session_key );

?>

2 . Application  Link  problem :

While I click on any link in my iframe application , I have found that it reloads the whole facebook page again in the iframe canvas. I just use this type of code and found the problem load  .

<a href=”http://apps.facebook.com/MyApp/invite.php”>Invite</a>

I found the solution in this thread : http://forum.developers.facebook.com/viewtopic.php?pid=208220

Only add the taget=”__top” into the anchor.

So I add target=”_top”. <a href=”http://apps.facebook.com/MyApp/invite.php”>Invite</a>.   And now it work.

3.iframe size problem  :

I have faced problem to resize my frame application. Initially when page load the frame size is correct. But when I show the facebook profile photo of users , then find that it does not resize. I do not see the footer and it cut down. We have solve this problem by adding  javascript setTimer to resize the height. You have seen similar type problem here : http://forum.developers.facebook.com/viewtopic.php?pid=17541#p17541

4.  Setting issues :

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I think to set up my application as an iframe application, I do not need to set up the connect url. But when I do not set up connect url I see blank page. So when I set up the call back url , I have found that my application working.

I have few more issues and will be add next topics.

Advertisement
    • venkatareddy.pammi
    • June 4th, 2010

    Hi,

    I am also facing the issue losing data on post. I have created 2 hidden fields as you suggested as below.

    String fb_sig_session_key = request.getParameter(“fb_sig_session_key”);
    fb_sig_session_key: 2.5Ev5zYHmwC7MMGqy6uZMgw__.3600.1275663600-100000841966691

    String user_id = request.getParameter(“fb_sig_user”);
    user_id =100000841966691

    I could able to see the values on get, when i use post still not able to send the data.

    My submission url is:
    http://apps.facebook.com/demotrianz/update.action

    can you please suggest if i am still missing anything?

    • @venkatareddy : i think may be you do not put the right way hidden field field values. I think you have to set values in this way because you said that you got the Get values.

      <input type="hidden" name="fb_sig_session_key" value=”
      4 <input type="hidden" name="user_id" value=”

      If you do not solve the problem, you can directly email me to here : thinker.bijon@gmail.com.

    • Chili
    • July 6th, 2010

    Hi,

    I really, really really have to thank you sooooo much!!!!! I had this apllication link problem about two days now and searched the whole developer forum and the world wide web for any help or idea what’s wrong with my simple html links. And today, finally, I found your page!!! And now it works. I’m sooooooo happy.

    THANK YOU A LOT!!!!!!!!!!!!

    • @Chili: Great to hear that you get help from this article. And i am also giving you thank that you share it . This will encourage me to write more post.

    • feisal
    • September 13th, 2010

    hi,

    i need some help please…..

    im trying to load facebook.com inside an iframe, but it wont work….the code fine its doing everthing it supposed to.

    what happens is a facebook logo and link appear and if clicked they open a top browser window.

    i need it to stay inside an iframe.

    any help would be great…willing to pay for a solution.

    thanks everyone

  1. @Saidur—->

    Wow!!! What a superb article this is!!! I have never found a useful article like this. This is so amazing. I was facing lot of problems while creating facebook applications since 2009. I fixed all of problems by reading your article. I have no words to thank you. Thank you very very much!!!

    I have only one problem left. That’s about how to resize iframe size automatically on facebook applications. I am using 760px Width Canvas.. Please help me for that.

    Please add me as you friend on facebook..
    http://www.facebook.com/nilupulkawinda

    Thank you very much!!!

    • koki
    • February 28th, 2011

    I found a way to create an iframe application without being a facebook developer . It’s totally crazy!!
    http://www.facebook.com/iframe.apps

    • Vish
    • May 14th, 2011

    Good post. Thanks for saving my time.

    • Emad
    • May 26th, 2011

    I have a problem on posting data in IFram , and I did all wat you say and still not working ..
    I am using a new API

    it gives me this exception :
    Uncaught OAuthException: An active access token must be used to query information about the current user.

    pleaaaase help I spent more than a day in it

      • Emad
      • May 28th, 2011

      pleaaaaaaaaaaaaaase help

    • Emad
    • May 28th, 2011

    no one can help me ????????????

    • Hi Emad,

      Could you please send me your code , then may be i can help you

    • Emad
    • May 31st, 2011

    I have same problem with posting but can’t solve with new API which use OAuth 2.0 protocol , can any one help me in that ?

  2. How many days will it take for the cheque to clear? coed teen porn 813

  3. I enjoy travelling lolita models
    452309

  4. A First Class stamp sandra model nn
    8-DD

    • Ryu
    • November 29th, 2011

    Halo i have the POST Submission problem but i can’t fix it.
    i send you the code and please help me.

  5. Me too i’ve a ploblem with accen token when i post on form wih 2,0 … any solution ???

  6. fantastic post, very informative.I wonder why the other specialists of this sector do not notice this.You must continue your writing.I’m sure, you have a great readers’ base already!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.