Apache Cordova/Phonegap应用程序上的Facebook点赞按钮 [英] Facebook like button on Apache Cordova/Phonegap app
问题描述
我已使用类似简单网站的方法插入了类似Facebook的按钮: https://developers.facebook.com/docs/plugins/like-button
I have inserted a facebook like button with this methods like a simple web: https://developers.facebook.com/docs/plugins/like-button
但是第一次按下按钮时,将打开一个登录窗口.该窗口在当前窗口中打开,而不是在新窗口中打开.用户登录窗口后,尝试自行关闭,但无法关闭.显示一个白色窗口. 下次,由于用户已登录,赞"按钮将正常工作.
But the first time that a button is pressed a login window opens. This window opens in the current window, not in a new window. After the user logs in the window try to close itself but it can't. A white window is showed. Next times the like button works correctly because the user is logged in.
我也尝试使用cordova插件"phonegap-facebook-plugin"实现,但它不支持赞"按钮. https://github.com/phonegap/phonegap-facebook-plugin
I also try to implement with the cordova plugin "phonegap-facebook-plugin" but it doesn't have support for like button. https://github.com/phonegap/phonegap-facebook-plugin
推荐答案
我认为您需要在他们完成登录后收听并重定向回您的应用程序,例如
I think you need to listen to when they've finished logging in and redirect back to you're application some like this.
仅将window.location
设置为file:///android_asset/www/index.html
之类的内容或要将用户返回到的任何页面.
Only with window.location
set to something like file:///android_asset/www/index.html
or whatever page you want to return the user to.
<fb:login-button onlogin="document.location.href='file:///android_asset/www/index.html';">
</fb:login-button>
<fb:login-button onlogin="document.location.href='file:///android_asset/www/index.html';">
</fb:login-button>
除了喜欢"按钮外,还可以这样吗?
Something like this but for the like button ?
这篇关于Apache Cordova/Phonegap应用程序上的Facebook点赞按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!