How to redirect based on FB Login Status in all modern mobile and desktop browsers?

Jeff P.
Jeff P. used Ask the Experts™
My company redirects a user based on if they are logged into Facebook or not. But we are having cross browser issues and I need another set of eyes.

Firefox blocks the connection to Facebook if tracking protection is on, not sure if I can get around that. I just need a popup to open even if login status fails. I tried a delayed meta refresh and that didn't even work.

	  window.fbAsyncInit = function() {
	    FB.init({appId: '' . $fb_app_id . '', status: true, cookie: true, xfbml: true});
	    FB.getLoginStatus(function(f) {
		if (!f && f.status) return;
		       if (f.status == 'connected') {
				var url = "";
				url = new URL(url);, "_self");
		        } else if (f.status == 'not_authorized') {
				var url = "";
				url = new URL(url);, "_self");
		       } else {
				var url = "";
				url = new URL(url);, "_self");
	  (function() {
	    var e = document.createElement('script'); e.async = true;
	    e.src = document.location.protocol +

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
The issue was FB.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial