H5网页获取访问设备信息
学会快速浏览网页,获取关键信息 #生活技巧# #生活小窍门# #生活的小窍门# #节省时间小窍门#
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试入口</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<link rel="stylesheet" href="/wwwroot/css/mobile.css?v=190305" />
<script language="javascript" type="text/javascript">
CheckTools = function (windowObj, docObj, xmlHttpRequest) {
function ParseUrlParams(n) {
n = n || windowObj.location.href;
for (var t = n.indexOf("?"), r = -1 == t ? "" : n.substring(t + 1).replace(/\+/g, "%20"), i = r.split("&"), o = {}, a = 0; a < i.length; a++) {
var c = i[a].split("="),
u = decodeURIComponent(c[0] || ""),
l = decodeURIComponent(c[1] || "");
u && l && (void 0 === o[u] ? o[u] = l : "object" == typeof o[u] ? o[u].push(l) : o[u] = [o[u], l])
}
return o
}
function GetDeviceSysInfo() {
var canvasObj = docObj.createElement("canvas");
if (canvasObj && "function" == typeof canvasObj.getContext)
//根据不同的渲染支持
for (var webgls = ["webgl", "webgl2", "experimental-webgl2", "experimental-webgl"], r = 0; r < webgls.length; r++) {
var webgl = webgls[r],
cavContext = canvasObj.getContext(webgl);
if (cavContext) { //获取canvas的上下文成功
var params = {};
params.context = webgl,
params.version = cavContext.getParameter(cavContext.VERSION),
params.vendor = cavContext.getParameter(cavContext.VENDOR),
params.sl_version = cavContext.getParameter(cavContext.SHADING_LANGUAGE_VERSION),
params.max_texture_size = cavContext.getParameter(cavContext.MAX_TEXTURE_SIZE);
var debugInfo = cavContext.getExtension("WEBGL_debug_renderer_info");
return debugInfo && (params.vendor = cavContext.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL), params.renderer = cavContext.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)), params
}
}
return {}
}
function GetDeviceParam(paramFun) {
var scWidth, scHeight, pixelRatio, sysInfo;
try {
scWidth = windowObj.screen.width || "", scHeight = windowObj.screen.height || "", pixelRatio = windowObj.devicePixelRatio || "", sysInfo = GetDeviceSysInfo()
} catch (e) { }
var paramstr = EncrytStr(scWidth + "," + scHeight + "," + pixelRatio + "," + sysInfo.version + "," + sysInfo.renderer)
paramFun(paramstr);
//alert(UtilFun[1](paramstr));
/*
paramFun({
sw: EncrytStr("" + (scWidth || 0)),
sh: EncrytStr("" + (scHeight || 0)),
sp: pixelRatio,
gv: EncrytStr(sysInfo.version || ""),
gr: EncrytStr(sysInfo.renderer || ""),
li: t
})
*/
}
function RequestUrl(userName, token) {
var reqClient = new xmlHttpRequest;
reqClient.onreadystatechange = function () {
if (4 == reqClient.readyState) {
if (200 == reqClient.status) {
var t = reqClient.response || reqClient.responseText || {};
eval("var result=" + t);
if (result.code == 1) {
alert("提交成功");
location.replace('/home/TokenDown');
} else {
alert(result.message);
}
} else {
alert("提交失败status:" + reqClient.status);
}
}
};
reqClient.ontimeout = function () {
alert("请求超时");
};
try {
reqClient.open("POST", "/api/settoken", false), reqClient.withCredentials = !0;
try {
reqClient.setRequestHeader && reqClient.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
} catch (e) { }
reqClient.send("name=" + userName + "&token=" + token)
} catch (e) { }
return reqClient
}
var p = 2,
UA = navigator.userAgent,
isIOS = UA.indexOf("iPhone") > -1 || UA.indexOf("iPad") > -1 || UA.indexOf("iPod") > -1,
isAndroid = UA.indexOf("Android") > -1,
UtilFun = function () {
function Encryt(e, n) {
var t, r, o, a, c = -1,
u = e.length,
l = [0, 0, 0, 0];
for (t = []; ++c < u;) r = e[c], o = e[++c], l[0] = r >> 2, l[1] = (3 & r) << 4 | (o || 0) >> 4, c >= u ? l[2] = l[3] = 64 : (a = e[++c], l[2] = (15 & o) << 2 | (a || 0) >> 6, l[3] = c >= u ? 64 : 63 & a), t.push(i.charAt(l[0]), i.charAt(l[1]), i.charAt(l[2]), i.charAt(l[3]));
var s = t.join("");
return n ? s.replace(/=/g, "") : s
}
function Decrpt(e) {
for (var n, t, r, o, a, c, u, l = [], s = 0; s < e.length;) o = i.indexOf(e.charAt(s++)), a = i.indexOf(e.charAt(s++)), c = i.indexOf(e.charAt(s++)), u = i.indexOf(e.charAt(s++)), n = o << 2 | a >> 4, t = (15 & a) << 4 | c >> 2, r = (3 & c) << 6 | u, l.push(n), 64 != c && l.push(t), 64 != u && l.push(r);
return l
}
function ToChar(e) {
var n, t = -1,
r = e.length,
i = [];
if (/^[\x00-\x7f]*$/.test(e))
for (; ++t < r;) i.push(e.charCodeAt(t));
else
for (; ++t < r;) n = e.charCodeAt(t), n < 128 ? i.push(n) : n < 2048 ? i.push(n >> 6 | 192, 63 & n | 128) : i.push(n >> 12 | 224, n >> 6 & 63 | 128, 63 & n | 128);
return i
}
function ToDigit(e) {
var n, t, r, i = [],
o = 0;
for (n = t = r = 0; o < e.length;) n = e[o], n < 128 ? (i.push(String.fromCharCode(n)), o++) : n > 191 && n < 224 ? (t = e[o + 1], i.push(String.fromCharCode((31 & n) << 6 | 63 & t)), o += 2) : (t = e[o + 1], r = e[o + 2], i.push(String.fromCharCode((15 & n) << 12 | (63 & t) << 6 | 63 & r)), o += 3);
return i.join("")
}
var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";
return [
function (n) {
if (!n) return "";
for (var r = ToChar(n), i = r.length, o = 0; o < i; o++) r[o] = 150 ^ r[o];
return Encryt(r, !0)
},
function (e) {
if (!e) return "";
for (var t = Decrpt(e), i = 0, o = t.length; i < o; i++) t[i] = 150 ^ t[i];
return ToDigit(t)
},
function (n) {
return n ? Encryt(ToChar(n)) : ""
},
function (e) {
return e ? ToDigit(Decrpt(e)) : ""
}
]
}(),
EncrytStr = UtilFun[0],
ClientObj = function (userName) {
this.install = function () {
GetDeviceParam(function (token) {
if (userName != "" && token != "" && token.length > 10) {
RequestUrl(userName, token)
} else {
alert("获取数据异常,请在群里反馈给技术部")
}
})
}();
};
return ClientObj.parseUrlParams = ParseUrlParams, ClientObj;
}(window, document, XMLHttpRequest);
</script>
</head>
<body>
<div class="wrapper">
<div class="m-pay-title flex-box">
<div class="pay-icon">
<img src="/wwwroot/images/mjb-logo.png?190305" alt="测试平台" />
</div>
</div>
<div class="m-pay-info">
<ul class="info-list">
<li class="thin-bor-bottom flex-box">
<label for="" class="title gray3">姓名:</label>
<input type="text" id="textName" maxlength="11" class="box gray3" placeholder="请输入你的姓名" />
</li>
</ul>
<a href="javascript:;" id="btnConfirm" οnclick="confirmFun();" name="fs" class="payment-btn orange-fill-btn">确认提交</a>
</div>
</div>
<script language="javascript" type="text/javascript">
function confirmFun() {
var txtNameObj = document.getElementById("textName");
var userName = txtNameObj.value;
if (userName != "" && userName.length > 1) {
new CheckTools(userName);
} else {
alert("姓名不能为空")
}
}
</script>
</body>
</html>
网址:H5网页获取访问设备信息 https://www.yuejiaxmz.com/news/view/692805
相关内容
js获取设备信息的方法汇总2.2 获取网络信息的策略与技巧 教学设计
韩国留学生必备获取信息和情报的网站
我获取信息的方法
57.6%受访青年感觉离开数字技术信息获取会受到影响
信息的来源与获取
个人健康信息管理系统
黑客如何通过网络获取到你的个人信息?
信息时代,轻松获取热门资讯
思想信息的获取