【问题标题】:Redirect website from facebook web browser to mobile's default browser将网站从 facebook 网络浏览器重定向到手机的默认浏览器
【发布时间】:2020-03-13 16:08:35
【问题描述】:

如何将任何网站从 Facebook 网络浏览器重定向到移动默认浏览器。我想使用 javascript 执行此操作。 这个我试过了

window.open('', '_system');

但是没有用。 有什么建议吗?

【问题讨论】:

    标签: javascript android iphone mobile


    【解决方案1】:

    我正在使用这个脚本,它运行良好,但它重定向到谷歌浏览器。

    <script>
        function isFacebookApp() {
            var ua = navigator.userAgent || navigator.vendor || window.opera;
            return (ua.indexOf("FBAV") > -1) || (ua.indexOf("FBAN") > -1);
        }
    if (isFacebookApp()) {
        var currentLink = location.href;
        if (currentLink.indexOf('https') > -1) {
            var currentLink = currentLink.replace('https://', '');
            currentLink = currentLink.replace('www.', '');
            var chromeLink = "intent://" + currentLink + "#Intent;scheme=https;package=com.android.chrome;end";
            window.location.href = chromeLink;
        }
        if (currentLink.indexOf('http') > -1) {
            var currentLink = currentLink.replace('http://', '');
            currentLink = currentLink.replace('www.', '');
            var chromeLink = "intent://" + currentLink + "#Intent;scheme=http;package=com.android.chrome;end";
            window.location.href = chromeLink;
        }
    } 
    </script> 
    

    【讨论】:

      猜你喜欢
      • 2014-05-03
      • 2017-09-25
      • 1970-01-01
      • 2022-12-11
      • 1970-01-01
      • 2014-08-12
      • 2016-09-20
      • 2012-10-30
      • 1970-01-01
      相关资源
      最近更新 更多