facebook iframe 应用程序 - 如何组织和编写代码以加快页面加载 - PHP SDK
我正在 Facebook iframe 中编写一个应用程序,但不确定如何最好地编写它。我最初在主 canvas.php 文件中编写了所有代码,但发现在结果加载到 iframe 之前一切都运行得太慢。
然后我尝试使用 php 标头定位方法来尝试将不同的页面加载到 iframe 中,从而减少页面加载时间。但是,标头位置将被忽略。
我还尝试使用 javascript 使页面加载到 iframe 中,这确实会加载到新页面中,但页面遇到很多问题。它不会使用 $_GET 将参数传递给自身。
基本上,当画布页面首次加载到 iframe 中时,我需要执行一些检查,然后重定向到另一个文件,以避免在每个页面加载时执行检查,因为这会严重显示所有内容。然后,我需要使用 URL 中的不同参数重新加载页面,以使用不同的结果填充 iframe,这又非常慢,因为它必须再次执行所有检查。
因此,如何才能像 facebook iframe 中的普通网站一样实现流畅的工作流程?
[编辑] 只是想 Ajax 是一个有效的选择吗?
非常感谢。
I am writing an app within a facebook iframe and am unsure how best to write this. I originally wrote all the code within the main canvas.php file but found everything was running too slow before results were being loaded into the iframe.
I then tried using the php header location method so to try and load different pages into the iframe, thus reducing page load time. However, the header location is ignored.
I have also tried using javascript to get the page to load within the iframe instead, this does load in the new page but the page experiences lots of problems. It wil not pass parrameteres to itself using $_GET.
Basically, I need to perform some checks when the canvas page is first loaded in the iframe and then re-direct to another file to avoid the checks being perfomed on every page load as this seriously shows everything down. I then need to have page reloads with different parrameteres in the URL to populate the iframe with different results, again this is very slow as it has to perfomr all the checks again.
Therefore, how can I achieve a smooth workflow as a normal site within a facebook iframe?
[EDIT] Just thought is Ajax a valid option?
Many thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于没有指定channelURL,大多数人都会遇到响应时间慢的情况。请参阅http://developers.facebook.com/docs/reference/javascript/
Most people experience slow response times due to not having a channelURL specified. See http://developers.facebook.com/docs/reference/javascript/