I have jquery dialog on my website. It pops up when page is loaded. I want to give my dialog facebook functionality (like button).
我的网站上有jquery对话框。它会在加载页面时弹出。我想给我的对话框facebook功能(如按钮)。
Now I want to:
现在我想:
- Dismiss dialog right after "Like" is clicked.
- I don't want to show dialog if the user already "Liked" the page.
单击“赞”后立即关闭对话框。
如果用户已“喜欢”该页面,我不想显示对话框。
Please note I don't have any application ID associated with my page (when it comes back). Any ideas?
请注意我没有与我的页面关联的任何应用程序ID(当它返回时)。有任何想法吗?
Thank you!
1 个解决方案
#1
1
There is no way to do that because of Same Origin Policy. You can only do that with FB API like;
由于同源策略,无法做到这一点。你只能用FB API这样做;
FB.api('/me/likes/your_page_id', {limit: 1}, function(response) {
if (response.data.length == 1) {
// User already liked your page, do not open dialog
} else {
// $("#dialog").dialog(); User not liked your page
}
});
For detect when user click, you can use;
用户点击时检测,可以使用;
FB.Event.subscribe('edge.create',
function(response) {
// User clicked like button
}
);
You can create FB App here
您可以在此处创建FB App
#1
1
There is no way to do that because of Same Origin Policy. You can only do that with FB API like;
由于同源策略,无法做到这一点。你只能用FB API这样做;
FB.api('/me/likes/your_page_id', {limit: 1}, function(response) {
if (response.data.length == 1) {
// User already liked your page, do not open dialog
} else {
// $("#dialog").dialog(); User not liked your page
}
});
For detect when user click, you can use;
用户点击时检测,可以使用;
FB.Event.subscribe('edge.create',
function(response) {
// User clicked like button
}
);
You can create FB App here
您可以在此处创建FB App