javascript - How to prevent popup blocker in facebook connect for web sites? -
i have created facebook login app site. pop-up blocker blocks it. searched in google says add onclick option , have one. still it's not working. have posted code below
js code:
$(document).ready(function() { window.fbasyncinitialize = function() { fb.init({ appid : '', // app id channelurl : '..../channel.html', // channel file status : true, // check login status cookie : true, // enable cookies allow server access session xfbml : true // parse xfbml }); fb.getloginstatus(function(response) { if (response.status === 'connected') { // connected apicall(); } else if (response.status === 'not_authorized') { // not_authorized login(); } else { // not_logged_in login(); } }); }; function login() { fb.login(function(response) { if (response.authresponse) { // connected apicall(); } else { // cancelled } }, { scope: 'email' }); } function apicall() { console.log('welcome! fetching information.... '); fb.api('/me', function(response) { var first_name = response.first_name; var last_name = response.last_name; var fb_id = response.id; var email = response.email; }); } // load sdk asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getelementsbytagname('script')[0]; if (d.getelementbyid(id)) {return;} js = d.createelement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_us/all.js"; ref.parentnode.insertbefore(js, ref); }(document)); });
html :
what should change or add prevent popup blocker issue ?
thanks
you redirect user login page rather popping authorisation dialog.
you make login triggered user action - if user clicks on link triggers popup less blocked (rather triggering login programmatically).
Comments
Post a Comment