1

我正在为现有网站开发 Facebook iFrame 应用程序。<iframe>我使用代码加载网页。我也有一个选项卡部分,包括选项卡项 Home、InviteFriends 等。但是选项卡和加载的网页之间有很多空白空间。

这是我的 index.php 文件

 <?php
  require_once 'appinclude.php';
  $user_id = $facebook->require_login();
 ?>

 <html xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:fb="http://www.facebook.com/2008/fbml">  

 <head></head>   

 <body>   
 <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" 
         type="text/javascript"></script>

 <div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>

 <fb:serverfbml style="height:200px; width:760px;"> 
 <script type="text/fbml"> 
  <fb:fbml> 
  <fb:tabs>
       <fb:tab-item href='http://my_site_ip/my_app_folder/' title='Home'       selected='true' target="_TOP"/>
     <fb:tab-item href='http://my_site_ip/my_app_folder/fav.php' title='My Favorites' target="_TOP"/>
     <fb:tab-item href="http://my_site_ip/my_app_folder/invite.php" title="Invite Friends" target="_TOP"/>    
   </fb:tabs>
   </fb:fbml>
 </script>
 </fb:serverfbml>

<?php echo '<iframe name="qantas" height="640px" width="740px" frameborder="0"    resizeable="true" scrolling="no" style="border:none" src="my_url" target="_TOP"></iframe>';?>

 <script type="text/javascript"> 

    FB.init("my_api_key", "../channel/xd_receiver.htm");

    FB_RequireFeatures(["CanvasUtil"], function(){
        FB.XdComm.Server.init("../channel/xd_receiver.htm");
        FB.CanvasClient.startTimerToSizeToContent();
});

  </script>    
 </body>  
</html>  

而且,当我单击“邀请朋友”选项卡时,我会在加载的网页上方的屏幕上看到一个黑框,而不是空白区域。如果我单击黑色区域,它会导航到邀请页面。如何去掉这个黑框,直接导航到邀请页面?

这是我的邀请.php 文件:

 <?php
  require_once 'appinclude.php';
  $user_id = $facebook->require_login();
 ?>

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:fb="http://www.facebook.com/2008/fbml">  

<head></head>   

<body>   

<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
 type="text/javascript">
</script>

<fb:serverfbml style="width: 776px;"> 
<script type="text/fbml"> 
  <fb:fbml> 
  <fb:tabs>
     <fb:tab-item href='http://apps.facebook.com/my_canvas_url/' title='Home'       selected='true' target="_TOP"/>
<fb:tab-item href='http://apps.facebook.com/my_canvas_url/fav.php' title='My Favorites' target="_TOP"/>
<fb:tab-item href="http://apps.facebook.com/my_canvas_url/invite.php" title="Invite Friends" target="_TOP"/>     
   </fb:tabs>

 <fb:request-form action="http://my_localhost_ip/FacebookApp/" 
        method="POST" 
        invite="true" 
        type="myWEb"
        target="_parent" 
        content="<fb:name uid='$user_id' useyou='false'></fb:name> is a member of myWeb.com and would like to share that experience with you.To register, simply click on the 'Register' button below.<fb:req-choice url='http://apps.facebook.com/my_canvas_url/index.php' label='Register'/>"> 

     <fb:multi-friend-selector showborder="false" actiontext="Invite your Facebook Friends to use myWeb" /> 

  </fb:request-form> 
  </fb:fbml> 
 </script>
 </fb:serverfbml> 

 <script type="text/javascript"> 
        FB.init("my_api_key", "../channel/xd_receiver.htm");
 </script>   
</body>  
</html>  
4

2 回答 2

0

在 iframe 应用程序中,我通过 javascript 重定向客户端解决了黑色(或灰色)层问题,使用

window.top.location.replace("http://apps.facebook.com/canvas_url/page_with_dark_layer");
于 2010-07-10T13:27:33.547 回答
0

似乎目标属性不适用于选项卡项。所以我按照 Facebook 开发者论坛成员的建议使用了 html 和 css 的组合。这是链接http://forum.developers.facebook.com/viewtopic.php?pid=121903我从中获取代码并相应地更改了我的应用程序。该人已提供 css 代码以使链接看起来像 Facebook 选项卡。因此,任何在使用 Tab 项时遇到此灰色框问题的人都可以使用该代码。

于 2010-07-20T11:52:09.047 回答