简体   繁体   中英

php sdk facebook integration login in popup

I am new to Facebook application development.

I used the php-sdk from the following url https://github.com/facebook/php-sdk . I run the example >> example.php. it works fine. While clicking the login link it opens the Facebook site. After login it redirects to my domain.

I want to change this as While clicking the login the Facebook login page will be opened in popup. After login it changes the link to logout. without refreshing the page. Is is possible?

PHP is a server-side scripting language, and as such can not perform actions such as opening a popup window. PHP can however redirect the user to a differnt URL which is the behaviour you currently have. In order to initiate a popup window - you will have to utilize a client-side language such as JavaScript.

You might want to checkout the Facebook JavaScript SDK and specifically the FB.login method. Taken from that documentation page :

Calling FB.login results in the JS SDK attempting to open a popup window. As such, this method should only be called after a user click event, otherwise the popup window will be blocked by most browsers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM