[英]Strange website redirect issue on mobile browser that's influenced by cache
[英]Redirect website from facebook web browser to mobile's default browser
如何將任何網站從 Facebook web 瀏覽器重定向到移動默認瀏覽器。我想使用 javascript 執行此操作。 我試過這個
window.open('', '_system');
但沒有用。 有什么建議嗎?
我正在使用這個腳本,它運行良好,但它重定向到谷歌瀏覽器。
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.