【问题标题】:Facebook JS SDK display:page is not workingFacebook JS SDK 显示:页面不工作
【发布时间】:2013-06-16 17:35:39
【问题描述】:

我想在同一网页中打开 Facebook 的 oauth 对话框。

实际上,我在我的 WIN32 (C++) 项目中嵌入了一个静态 html 页面,并且我正在使用 Facebooks 的 JS SDK 来执行 oauth 操作,因为 IE 无法承受 url 长度超过 2K(大约)。

显示选项 popuptouch 工作正常,但选项 pageiframe 不工作。

这里是代码;

<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
  FB.init({
    appId      : '*************', // App ID
    channelUrl : 'file:///D:/channel.htm', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });

    FB.ui(
    {
        method: 'oauth',
        name: 'Facebook Dialogs',
        link: 'http://localhost',
        picture: 'http://fbrell.com/f8.jpg',
        caption: 'Reference Documentation',
        description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
        display: 'page'
    },
     function(response) {

        if (response && response.post_id) {
          //alert('Post was published.');
        } else {
          //alert('Post was not published.');
        }
      }
    );
  };
</script>

请任何人告诉我,我在上述代码中缺少什么以在同一网页中打开 oauth 对话框。

谢谢, 斯卡尔。

【问题讨论】:

    标签: c++ facebook winapi oauth facebook-javascript-sdk


    【解决方案1】:

    我遇到了a similar problem in the past

    这是我得到的答案:

    JS SDK 旨在用于网站(根据定义提供并可通过 http 或 https 访问),我们不打算支持使用 file: 或任何其他协议。 这与一般的插件一致,其中 http/https URI 可用作标识符(开放图等),但 file:// URI 不可用。

    您可以尝试在 Web 可访问文档中初始化 SDK,包括使用 iframe - 请注意,您必须添加逻辑以确保正确调整大小。

    作为对Facebook bug report 的回复。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多