如果浏览器是android webview,如何使用javascript检测? [英] how to detect with javascript if browser is an android webview?
本文介绍了如果浏览器是android webview,如何使用javascript检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个webapp,并且该用户只能使用android webview? 我可以使用javascript检测android webview吗?
I am creating a webapp and the user could only have acces with the android webview? Can i detect android webview with javascript?
推荐答案
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid) {
// Do something!
// Redirect to Android-site?
window.location = 'http://android.davidwalsh.name';
}
来源: http://davidwalsh.name/detect-android
这篇关于如果浏览器是android webview,如何使用javascript检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文