Facebook应用程序,对话在用户墙上发布,使用javascript api,在浏览器中弹出窗口 [英] facebook application, dialogue to publish on user's wall, using javascript api, pop-up blocked in browsers

查看:181
本文介绍了Facebook应用程序,对话在用户墙上发布,使用javascript api,在浏览器中弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JS-API生成一个对话框,要求发布我的应用程序生成的状态消息的权限。下面给出的是我正在谈论的截图:

i am using JS-API to generate a dialogue which asks for permission to publish the status message generated by my Application. given below is the screenshot of what i am talking about:

这里是代码:

FB.ui(
   {
     method: 'feed',
     name: 'Facebook Dialogs',
     link: 'http://developers.facebook.com/docs/reference/dialogs/',
     picture: 'http://fbrell.com/f8.jpg',
     caption: 'Reference Documentation',
     description: 'Dialogs provide a simple, consistent interface for applications to interface with users.',
     message: 'Facebook Dialogs are easy!'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

我使用文档中所述的示例JS代码,如果弹出窗口不是在浏览器设置中被阻止。但没有显示状态消息没有应用程序的实用程序!
请帮助我在最后阶段停留。谢谢!!

i use the sample JS code as told in the documentation and it works well if pop-ups are not blocked in the browser settings. but without status message being displayed there's no utility of the app!! Please help im stuck at the last stage. thanks!!

推荐答案

我不明白为什么会打扰你。如果用户阻止FACEBOOK弹出窗口,那就是他的损失!

I don't see why it's bothering you. If the user is blocking FACEBOOK pop-up then it's his loss!

无论如何,如果您真的需要处理所有案例,那么您可以选择不同的方式。阅读 Feed对话

Anyway, if you really need to handle all cases, then you can choose a different way. Have a read of the Feed Dialog.

您可以做的是当您从上一步完成时将您的页面重定向到Facebook Feed方法,以便打开页面:

What you could do is when you are done from the previous step you redirect your page to the Facebook feed method so it'll open as a page:

http://www.facebook.com/dialog/feed?
  app_id=123050457758183&
  link=http://developers.facebook.com/docs/reference/dialogs/&
  picture=http://fbrell.com/f8.jpg&
  name=Facebook%20Dialogs&
  caption=Reference%20Documentation&
  description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
  message=Facebook%20Dialogs%20are%20so%20easy!&
  redirect_uri=http://www.example.com/response

这里的更改是 app_id redirect_uri ,因此您的代码将如下所示:

The important part to change here is the app_id and redirect_uri, so your code would look like:

...
previous code
...
inside previous code success response
...
var url = "http://www.facebook.com/dialog/feed?" +
            "app_id=" + YOUR_APP_ID + "&" +
            "link=http://developers.facebook.com/docs/reference/dialogs/&" +
            "picture=http://fbrell.com/f8.jpg&" +
            "name=Facebook%20Dialogs&" +
            "caption=Reference%20Documentation&" +
            "description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&" +
            "message=Facebook%20Dialogs%20are%20so%20easy!&" +
            "redirect_uri=" + YOUR_REDIRECT_URI;
top.location.href = url;

这篇关于Facebook应用程序,对话在用户墙上发布,使用javascript api,在浏览器中弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆