function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i
var browser = { os : function() { var u = navigator.userAgent; return {// 操作系统 linux: !!u.match(/\(X11;( U;)? Linux/i), // Linux windows: !!u.match(/Windows/i), // Windows android: !!u.match(/Android/i), // Android iOS: !!u.match(/\(i[^;]+;( U;)? CPU
判断页面浏览设备是手机还是电脑,代码如下: function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sU
本文转自:http://www.cnblogs.com/duanguyuan/p/3534470.html 先给出一个实例:判断windows.linux.android 复制以下代码另存为html文件即可. <html> <head> <title>判断操作系统</title> <script type="text/javascript"> function detectOS() { var sUserAgent = nav