Facebook通过FB.ui停止自定义参数(图像,标题,描述)吗? [英] Facebook stops custom parameters (image,title,description) through FB.ui?

查看:657
本文介绍了Facebook通过FB.ui停止自定义参数(图像,标题,描述)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我检查了我的网站,此代码不起作用:

Today I check my site and this code not working:

<script>
...
    FB.ui({
            display: 'dialog',
            method: 'share_open_graph',
            action_type: 'og.likes',
            hashtag: '#Testing',
            action_properties: JSON.stringify({
                object: {
                    'og:image': img,
                    'og:image:secure_url': img,
                    'og:image:type': 'image/jpeg',
                    'og:image:width': w,
                    'og:image:height': h,
                    'og:image:alt': img,
                    'og:url': link,
                    'og:title': title,
                    'og:description': desc,
                    'fb:admins': fbadmin
                }
            })
        },
        function(response) {
            if (typeof response != 'undefined') {
                //Success
            } else {
                //Not Success;
            }
        });
</script>

使用此代码,来自 https://developers.facebook.com /docs/sharing/reference/share-dialog/:

FB.ui({
  method: 'share',
  href: link,
}, function(response){});

Facebook看到并拍摄了链接的照片,但没有看到我需要共享的照片. 显然,FB更改了共享策略.

Facebook sees and takes a picture of the link, but not the picture that I need share. Apparently FB changed policy of sharing.

现在如何自定义参数共享对象?如果此链接包含很多图片,如何设置自定义图像?

How to now I can customize paramateres for sharing? How to I can set custom image if this link has a lot of pictures?

已编辑

在没有 og:url 的情况下,它再次起作用,但是在单击成功共享Facebook上的内容之后,重定向到了板载URL上,而不是我需要共享的URL上.

Without og:url it worked again, but after click successfully shared content on facebook, redirected on board url, not on url that I need share.

推荐答案

我今天也遇到了麻烦,对我来说,解决方案是从打开的图中删除'og:url':链接对象,然后又可以工作了.我只有网址,标题,描述和图片.

I've been having a hard time with this today as well and the solution for me was to remove the 'og:url': link from the open graph object and then it worked again. I only had url, title, description and image though.

这篇关于Facebook通过FB.ui停止自定义参数(图像,标题,描述)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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