internet explorer - No Reload After Facebook Login on IE -
i using facebook php sdk , facebook js sdk manage authentication in web app. flow should go this: click fb login button -> launch oauth dialog -> enter account details oauth dialog -> oauth dialog closes , web page reloads (now showing content authenticated user). pretty standard, think.
i subscribing auth.login , auth.logout, , worked in firefox, in ie 10 did not reload after oauth dialog -- had manually reload view site authenticated user. testing alerts (and reading other questions on so), appears facebook's auth.login event not fire @ under ie 10 (though auth.logout worked fine). switched subscribing auth.authresponsechange event, , reloads under both firefox , ie 10.
however, i'm still having same problem under ie 9: no reload after oauth closes. auth.authresponsechange event recognized, not appear fire under ie 9 until after manual reload of page. obviously, as we'd love drop it, ie 9 used enough supporting not optional, , requiring manual reload after login unacceptable.
i believe code good, works in other browsers , code triggered auth.authresponsechange event runs correctly in ie 9 once event triggered -- problem reason, event isn't triggering until after manual reload. still, here fb init code reference:
<!-- start facebook connect --> <div id="fb-root"></div> <script> function setcookie(name,value,days) { if (days) { var date = new date(); date.settime(date.gettime()+(days*24*60*60*1000)); var expires = "; expires="+date.togmtstring(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function clearcookie(name) { setcookie(name,"",-1); } // main init code window.fbasyncinit = function() { fb.init({ appid : '<?=$vt->conf->fb->appid?>', channelurl : '//<?=$vt->conf->domain?>/fb_channel.html', status : true, cookie : true, xfbml : true }); // additional init code here <?php if ($page->vt->auth->usingfacebook) { ?> fb.event.subscribe('auth.authresponsechange', function(response) { if (response.status != 'connected') { // user has been logged out //console.log('fb: logout'); alert('fb logout'); clearcookie('vt_fbat'); window.location.reload(true); } }); <?php } else { ?> fb.event.subscribe('auth.authresponsechange', function(response) { if (response.status == 'connected') { // user has been logged in //console.log('fb: login'); alert('fb login'); setcookie('vt_fbat',response.authresponse.accesstoken); window.location.reload(true); } }); <?php } ?> // // //fb.event.subscribe('auth.authresponsechange', function(response) { // alert('fb: login'); // console.log('fb: login'); // console.dir(response); // setcookie('vt_fbat',response.authresponse.accesstoken); // window.location.reload(true); //}); //fb.event.subscribe('auth.logout', function(response) { // console.log('fb: logout'); // clearcookie('vt_fbat'); // window.location.reload(true); //}); }; // 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)); </script> <!-- end facebook connect --> since works in other browsers , i've double-checked source under ie 9 sure, i'm confident php working properly, know: uses php fill in app id , channel file url. also, print different javascript depending whether php sdk detects being logged facebook already. if we're logged in facebook, it's watching logout; if we're not, it's watching login. necessary because of switching auth.authresponsechange, fires time.
i've read multiple related questions on , tried can think of, can't work under ie 9. can make suggestions?
Comments
Post a Comment