0

Im getting a strange bug with facebook browser where My social login just dont work for some reason. It is like the facebook app browser cant open a new window when some one tries to signup with socials like google or facebook and throws Me a blank window with a "closing window..." message.

I have tried to find some answers on the web but its a little bit more complicated than just putting it with a googlechrome://navigate?url=url.com or googlechrome://url.com, is there any other way to make the user (with js or html) get redirected from a normal browser and not facebooks for both android and ios?

Now just to explain, I guess there is nothing special in the code/links, the social signup links are just opened in small windows on desktops or a new window in mobile via chrome or any other browser (except facebooks).

Any chance any of You wizards encountered a problem like that and found a good solution?!

<a class="btn-fb"
  href="loginwith_facebook"
  target="_blank"
  onclick="openOAuthLogin(this, event)"
  data-category="some_category"
  data-action="Click"
  data-label="Connect"
  >
    <i class="fa fa-facebook"></i>
    <span class="facebook-label desk">Continue with Facebook</span>
    <span class="facebook-label mob">Facebook</span>
</a>

and JS:

function openOAuthLogin(element, event) {
  window.open(element.href, 'Login', 'width=500, height=500');
  event.preventDefault();
}
Eddie
  • 26,593
  • 6
  • 36
  • 58
z3r0
  • 39
  • 1
  • 7
  • 1
    Well if popups are the main problem, then I’d try to replace window.open first of all, and handle login in the same window instance, instead of a new one. (Specifics might depend on which login flow you are using, this can’t be done with FB.login from the JS SDK, you would have to implement it yourself in that case, https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow) – 04FS Apr 23 '19 at 06:58
  • @04FS Yea, even if I make it open in the same window the only social's login/signup I would be able to have is linkedin (for some reason) and facebook if I set it up, I have 4 of them so I just removed the socials for FB browser and made some changes for certain mobile devices, thanks! – z3r0 Apr 23 '19 at 08:08

1 Answers1

0

OK so the best practice is to catch the browser type and just remove the social option for login or signup with

function isFacebookApp() {
    var ua = navigator.userAgent || navigator.vendor || window.opera;
    return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}
if(isFacebook){
//ToDo: some logic or ui manipulation
}

Unfortunately We have no power over the facebook browser and the only way user can be redirected out of it is by the user itself by checking some option this way.

For us developers, We just have to leave the form way of login/signup.

z3r0
  • 39
  • 1
  • 7