我受到谷歌地图的启发, 当它检测到本机浏览器时,建议在应用程序中使用它 检测过程很简单,但我不确定,
问题是:
在 ANDROID 设备上 我如何强制我的网站用户退出本机浏览器并在默认(外部)浏览器中打开它
谷歌浏览器:
googlechrome://域名
这是简单的检测片段
function isInFacebookApp() {
return /FBAV/i.test(navigator.userAgent);
}
if (isInFacebookApp()) {
// do somthing window.open("https://my-website.com");
} else {
console.log("native browser not detected");
}`
经过一点测试后,我发现这个并且工作得很好
就我而言 android 和默认浏览器 google-chrome
// 对于 Android 使用“意图:”链接
if (/Android/i.test(navigator.userAgent)) {
window.location.href = 'intent:https://your-website.com#Intent;end';
} else {
// For other platforms, use window.open with a fallback
window.open('https://your-site.com');
}