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.
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.
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.
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
@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!!!
I found a way to create an iframe application without being a facebook developer . It’s totally crazy!!
http://www.facebook.com/iframe.apps
Good post. Thanks for saving my time.
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
pleaaaaaaaaaaaaaase help
no one can help me ????????????
Hi Emad,
Could you please send me your code , then may be i can help you
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 ?
For example, inside a stock option trade in Microsoft, an investor
is not literally buying Microsoft shares, but instead opening a binding agreement
on perhaps the shares of Microsoft will increase or decrease within a specified time period.
If you’re in the beginning stages in the world of binary options, pick
the shorter expiration dates, since this will help you get yourself a feel to the market and
never have to analyze long-term market chatter.
This provides investors the ability to gain back the money they invest.
I leave a leave a response whenever I appreciate a article on a site or if I have something to contribute to the conversation.
It is triggered by the fire displayed in the article I looked at.
And after this article Facebook IFRAME Application Issues : PART-1 | Saidur Rahman Bijon.
I was excited enough to post a commenta response 🙂 I
do have a couple of questions for you if it’s okay. Is it simply me or do
some of the responses appear like left by brain dead folks?
😛 And, if you are posting on additional sites,
I would like to follow everything new you have to post.
Could you make a list the complete urls of all your public
pages like your twitter feed, Facebook page or linkedin profile?
Your bag really should be in a position to have at least
a minimum of 14 golf clubs. Just like most other medications, there are some facet results that
might occur because of to taking Prilosec. Stay clear of specially
fried meals or fatty meals.
Some really nice and useful information on this web site, also I conceive the style and design holds superb features. ceffgdabdkdd
I like the valuable info you provide in your articles. I will bookmark your blog and check again here regularly. I am quite certain I’ll learn a lot of new stuff right here! Best of luck for the next! efdffedbeega
Because here is a list of multiplayer games is that the leave was asked for more. gkdgdebgfkeb
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get
several emails with the same comment. Is there any way you can remove me from that
service? Thanks!