简体   繁体   中英

Redirect website from facebook web browser to mobile's default browser

How can I redirect any website from Facebook web browser to mobile default browser.I want to do this using javascript. I have tried this

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

but didn't work. Any recommendations?

i'm using this script it works perfectly, but it redirects to google chrome.

<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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM