Untitled
unknown
plain_text
2 months ago
1.3 kB
3
Indexable
(function () { // Detect Instagram WebView function isInstagramWebView() { let ua = navigator.userAgent || navigator.vendor || window.opera; return ua.includes("Instagram"); } // Redirect to native browser function redirectToNativeBrowser() { let url = window.location.href; // For Android: Use intent:// to force open in Chrome if (/android/i.test(navigator.userAgent)) { window.location.href = `intent://${url.replace(/^https?:\/\//, '')}#Intent;scheme=https;package=com.android.chrome;end;`; } // For iOS: Try opening in Chrome, fallback to Safari else if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { let chromeUrl = "googlechrome://" + url.replace(/^https?:\/\//, ''); let newTab = window.open(chromeUrl, "_blank"); // If Chrome is not installed, fallback to Safari setTimeout(() => { if (!newTab || newTab.closed) { window.location.href = url; } }, 500); } } // Run only if inside Instagram WebView if (isInstagramWebView()) { setTimeout(redirectToNativeBrowser, 1000); // Delay for better execution } })();
Editor is loading...
Leave a Comment