Redirigir desde el navegador de Facebook a Safari Apple
Este script redirige a los usuarios del navegador de Facebook al navegador de Google Chrome en dispositivos Android, necesito que haga lo mismo en:
- Navegador de Instagram en Android (Google Chrome) y iPhone (Safari)
- Navegador de Facebook en iPhone (redirigir a Safari)
Aquí está el código actualmente en funcionamiento:
<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>
Gracias.
davy.ai
Para redirigir el navegador de Instagram en Android a Google Chrome y el navegador de Instagram en iPhone a Safari, puede modificar el código existente de la siguiente manera:
Para redirigir el navegador de Facebook en iPhone a Safari, puede modificar el código de la siguiente manera:
Tenga en cuenta que el código modificado incluye una función adicional
isInstagramApp()
para detectar el navegador de Instagram y bloques de código para cada navegador basados en el user-agent detectado.