Facebook like button on Apache Cordova/Phonegap ap

2020-07-27 04:01发布

问题:

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.

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

回答1:

I think you need to listen to when they've finished logging in and redirect back to you're application some like this.

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>

Something like this but for the like button ?