I am new to Facebooks applications, so forgive me if I got something wrong.
How do I prompt users to install my application when they visit my application's canvas page?
You need to put below code on top of the first access page to your application:
$facebook = new Facebook($api_key, $secret);
$facebook->require_frame();
$user = $facebook->require_login();
//catch the exception that gets thrown if the cookie has an invalid session_key in it
try
{
if (!$facebook->api_client->users_isAppUser())
{
$facebook->redirect($facebook->get_add_url());
}
}
catch (exception $ex)
{
//this will clear cookies for your application and redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($iframepath);
}
Put in the your own API key and secret key. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With