有没有一种方法可以从Facebook浏览器(onClick)重定向用户,从而强制URL在chrome或任何其他浏览器中打开? [英] Is there a way to redirect users from facebook browser (onClick) enforcing the URL to open in chrome or any other browser?

查看:132
本文介绍了有没有一种方法可以从Facebook浏览器(onClick)重定向用户,从而强制URL在chrome或任何其他浏览器中打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Facebook浏览器时遇到一个奇怪的错误,在该错误中,由于某种原因,我的社交登录名不起作用.就像Facebook应用浏览器无法打开新窗口时,有人尝试注册google或facebook之类的社交网站,并向我扔出空白窗口并显示正在关闭窗口..."消息.

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.

我试图在网络上找到一些答案,但是它比将其与googlechrome://navigate?url = url.com或googlechrome://url.com放在一起要复杂得多,还有其他方法吗?使用户(使用js或html)从普通浏览器重定向,而不是从android和ios的facebook重定向的方法?

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?

现在仅要解释一下,我想代码/链接没有什么特别的,社交注册链接只是在台式机上的小窗口中打开,或者通过chrome或任何其他浏览器(facebooks)在移动设备中打开一个新窗口.

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>

和JS:

function openOAuthLogin(element, event) {
  window.open(element.href, 'Login', 'width=500, height=500');
  event.preventDefault();
}

推荐答案

好的,所以最佳实践是捕获浏览器类型,而只需删除用于登录或注册的社交选项

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
}

不幸的是,我们无法控制facebook浏览器,只能通过选中某些选项

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.

这篇关于有没有一种方法可以从Facebook浏览器(onClick)重定向用户,从而强制URL在chrome或任何其他浏览器中打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆