检测设备是PC还是手机客户端
1.引用 /Files/ggbbeyou/useragents.rar
2.
<script type="text/javascript" src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="~/Scripts/useragents.js"></script>
<script type="text/javascript">
Browsers = new UserAgents(navigator.userAgent, {
useFeatures: true,
detectCamouflage: true
});
$(function () {
$("#txtBrower").val(Browsers);
});
</script>
以下是参数: '"camouflage": "' + (Browsers.camouflage ? '1' : '0') + '",' +
'"features": "' + (Browsers.features.join(',')) + '",' +
'"browserName": "' + (Browsers.browser.name ? Browsers.browser.name : '') + '",' +
'"browserChannel": "' + (Browsers.browser.channel ? Browsers.browser.channel : '') + '",' +
'"browserVersion": "' + (Browsers.browser.version ? Browsers.browser.version.toString() : '') + '",' +
'"browserVersionType": "' + (Browsers.browser.version ? Browsers.browser.version.type : '') + '",' +
'"browserVersionMajor": "' + (Browsers.browser.version ? Browsers.browser.version.major : '') + '",' +
'"browserVersionMinor": "' + (Browsers.browser.version ? Browsers.browser.version.minor : '') + '",' +
'"browserVersionOriginal": "' + (Browsers.browser.version ? Browsers.browser.version.original : '') + '",' +
'"browserMode": "' + (Browsers.browser.mode ? Browsers.browser.mode : '') + '",' +
'"engineName": "' + (Browsers.engine.name ? Browsers.engine.name : '') + '",' +
'"engineVersion": "' + (Browsers.engine.version ? Browsers.engine.version.toString() : '') + '",' +
'"osName": "' + (Browsers.os.name ? Browsers.os.name : '') + '",' +
'"osVersion": "' + (Browsers.os.version ? Browsers.os.version.toString() : '') + '",' +
'"deviceManufacturer": "' + (Browsers.device.manufacturer ? Browsers.device.manufacturer : '') + '",' +
'"deviceModel": "' + (Browsers.device.model ? Browsers.device.model : '') + '",' +
'"deviceType": "' + (Browsers.device.type ? Browsers.device.type : '') + '",' +
'"deviceWidth": "' + (Browsers.device.type != 'desktop' ? screen.width : '') + '",' +
'"deviceHeight": "' + (Browsers.device.type != 'desktop' ? screen.height : '') + '",' +