这个网站是一个JavaScript代码示例,用于检测用户的设备类型和浏览器信息。主要功能如下:

  1. 检测Android设备:通过检查navigator.userAgent中是否包含”Android”字符串来判断用户是否使用Android设备。
  2. 检测iOS设备:通过检查navigator.userAgent中是否包含”iPhone”、”iPad”或”iPod”字符串来判断用户是否使用iOS设备。
  3. 检测Sqkb(可能是某个特定品牌或公司的浏览器):通过检查navigator.userAgent中是否包含”com.jzyd”字符串以及document.cookie中是否包含”com.jzyd”字符串来判断用户是否使用该浏览器。
  4. 更新基本字体大小:根据设备的宽度计算出一个基本字体大小(假设页面宽度为750px),并在页面上应用这个基本字体大小。
(function () {
var device = {
Android: function () {
return !!navigator.userAgent.match(/Android/i);
},
iOS: function () {
return !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Sqkb: function () {
return !!navigator.userAgent.match(/com\.jzyd/i) || !!document.cookie.match(/com\.jzyd/i);
}
};

var updateBaseFontSize = function () {
var dWidth = document.documentElement.clientWidth;
var baseFontSize = dWidth * 100 / 750;
if (!(device.Android() || device.iOS() || device.Sqkb())) {
var html = document.getElementsByTagName("html")[0];
var style = document.createElement("style");
var cssText = "html {" + "font-size: " + baseFontSize + "px;";
cssText += "}";
style.innerHTML = cssText;
html.firstChild.appendChild(style);
}
};

window.addEventListener("load", updateBaseFontSize);
})();