如何触发Facebook喜欢从图像地图? [英] How to trigger Facebook Like from an image map?

查看:97
本文介绍了如何触发Facebook喜欢从图像地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试一段时间来创建包含喜欢图标的图像,但是我希望该图标为直播,即当点击该图标时,该图标将发生在当前页面上。我知道如何使用图像映射,但我不明白如何链接到喜欢应用程序。请帮助...

I've been trying for some time to create an image including the "like" icon but I'd like the icon to be "live", i.e when clicking on it the "like" action happens to that current page. I know how to use image map but I dont understand how link it to the "like" application. please help...

推荐答案

您不能从您的代码触发像页面这是因为类似的按钮在iframe中运行,因此无法从您的代码中访问。

You can't trigger the Like a page from your code, this is because the like button is running inside an iframe and therefore isn't accessible from your code.

唯一可以从代码触发自己的Like操作是 像Facebook上的一个对象你发现更多关于这个问题。

The only Like action you can trigger yourself from code is "Like an object on Facebook", you find more about that in this question.

如果您希望事件在用户按下Like按钮后在您的页面上触发,您可以通过订阅使用Facebook Javascript SDK 进行类似活动。

If you want an event to trigger on your page after a user have pressed an Like button you can do it by subscribing to the like event using the Facebook Javascript SDK.

您可以在文档这里

FB.Event.subscribe('edge.create',
    function(response) {
        alert('You liked the URL: ' + response);
    }
);

这篇关于如何触发Facebook喜欢从图像地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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