Facebook iframe分享并邀请不在IE上工作的按钮

时间:2012-11-12 14:43:00

标签: php facebook iframe facebook-iframe

使用WooBox我为页面创建了一个自定义选项卡。此自定义选项卡使用iFrame在我的服务器上显示PHP文件。事实上,这个PHP有一个Facebook共享和一个Facebook邀请按钮,可以在Firefox上工作,但不能在Internet Explorer上工作:

有问题的标签是这个:http://www.facebook.com/?ref=canvas#!/pages/Mulheres-Apaixonantes/127782210574538?sk=app_369079553142218

PHP文件相当简单,我在这里发布了相关内容:

<?php header("p3p: CP=\"ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV HONK\"");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">

然后是带有2个元标记的HEAD标记,标题和样式标记,然后是:

<script>
function fb_share(){
FB.ui({
    method: 'feed',
    name: 'Jardim Botânico UTAD',
    caption: '',
    link: 'http://facebook.com/utadjb',
    picture: 'http://jb.utad.pt/img/site/logotipo200200.png',
    description: 'Acabei de ver a página do facebook do Jardim Botânico UTAD!'
},
function(response){
    if(response){
        alert('Post was published.');
    }else{
        alert('Post was not published.');
    }
});
}

function fb_invite(){
FB.ui({
    method: 'apprequests',
  message: 'Acabei de ver a página do facebook do Jardim Botânico UTAD em http://facebook.com/utadjb! Vê também!'
},
function(response){
    if (response){
        alert('Post was published.');
    }else{
        alert('Post was not published.');
    }
});
}
</script>

在这里面是按钮的调用方式:

      <div id="share_posttowall" class="shareoption"><span>Partilhe no seu mural</span><a onclick="fb_share(); return false;" class="fbbluebutton" href="#">Partilhar</a></div>
      <div id="share_sendinvite" class="shareoption"><span>Convide os seus amigos</span><a onclick="fb_invite(); return false;" class="fbbluebutton" href="#">Convidar</a></div>

有人知道为什么这两个按钮无法在Internet Explorer上运行?我已经用尽所有可能的故障排除......

1 个答案:

答案 0 :(得分:1)

  

我已经用尽所有可能的故障排除......

除了查看浏览器的错误控制台外,您的意思是?

点击这些按钮中的任何一个,我在所有浏览器中找到了“FB未定义”的内容 - 这并不是特别令人惊讶,因为您似乎没有嵌入JS SDK