问题
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();
}
回答1:
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.
来源:https://stackoverflow.com/questions/55783157/is-there-a-way-to-redirect-users-from-facebook-browser-onclick-enforcing-the-u