问题描述
我正在使用iframe从服务器渲染我的应用程序.问题是,一旦我单击应用程序中的链接,就会被重定向到服务器.我的意思是,我停留在画布页面上一秒钟,然后突然将其重定向到服务器上的应用程序URL,而不是在Facebook网站上的iframe中查看它.我正在使用PHP和MySQL.
i am using iframe to render my app from my server. the problem is once i click on a link in my app, i am being redirected to my server. i mean, i remain in tha canvas page for a second, then suddenly instead of viewing it in an iframe on the facebook website, i am redirected the app URL on my server. I am using PHP and MySQL.
为什么会这样.
firebug信息:这是firebug提供的POST信息.由于上述问题,它也没有发布到数据库.
the firebug info: this is the POST info that firebug is giving. due to the above problem it is also not POSTing to the DB.
<html>
<body>
<script type="text/javascript">
top.location.href = "http://www.facebook.com/login.php?v=1.0&api_key="xxxxx"&next=http%3A%2F%2F<my-web-server.com>%2F<appfolder>%2Fuser_submit.php";
</script>
编辑
显然,它在Mac版Chrome中运行良好.
EDIT
apparently, it is running fine in Chrome for Mac.
编辑2
我刚刚通过Firebug通过[停止]在Facebook页面上的浏览器发现的结果:仅应用程序的这一部分正在Facebook页面上加载.将应用程序的其余部分重定向到我的服务器后,便会加载该文件.
EDIT 2
what i just found out by [Stopping] the browser on the facebook page through Firebug: only this part of the app is being loaded on the Facebook page. the rest of the app gets loaded after it redirects it to my server.
<body>
<div id="wrap-iframe">
<script type="text/javascript">
top.location.href = "http://www.facebook.com/login.php?v=1.0&api_key="xxxxx"&next=http%3A%2F%2Fmy-domain-server.com%2Fapplocation%2Fuser.php";
</script></div></body>
编辑3
我做了一些修修补补,显然,它进一步激怒了它.现在,即使是首页也将我重定向.如果我只记得我做了什么... :-(
EDIT 3
I did some tinkering and apparently, it has angered it even further. now even the first page redirects me. If only I remembered what I did...:-(
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/user.php:7) in /home/amitver/public_html/roadies/facebook.php on line 257
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/user.php:7) in /home/amitver/public_html/roadies/facebook.php on line 257
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/user.php:7) in /home/amitver/public_html/roadies/facebook.php on line 257
Warning: Cannot modify header information - headers already sent by (output started at /home/amitver/public_html/roadies/user.php:7) in /home/amitver/public_html/roadies/facebook.php on line 261
推荐答案
http://www.facebook.com/login.php?v=1.0&api_key= "xxxxx"& next = http://someurl.com/user.php&canvas=1 ";
http://www.facebook.com/login.php?v=1.0&api_key="xxxxx"&next=http://someurl.com/user.php&canvas=1";
添加canvas = 1似乎可以解决问题.将其保留在画布中,并且不会打开回调URL.
adding canvas=1 seems to do the trick. Keeps it within the canvas and doesn't open the callback url.
这篇关于Facebook应用程序重定向到画布视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!