浏览器内核版本检测页面
一个网页
有时候想知道自己手机的浏览器版本或者微信的浏览器版本,于是上网找了下,找到一个浏览器内核版本检测页面:ie.icoa.cn/。非常简单,没什么复杂的功能。
PC
手机企业微信浏览器
ChatGPT开发
看着这个页面不复杂,就让ChatGPT帮我写了一个,把它放在CDN上了:cdn.uino.cn/deno/ua.htm…
交流信息:shareg.pt/r6ovSUv
最终代码176行,有需要的自取:
浏览器信息检测 body { font-family: Arial, sans-serif; padding: 20px; } h1 { margin-bottom: 20px; } #result { border: 1px solid #ccc; padding: 20px; background-color: #f5f5f5; } @media screen and (max-width: 480px) { /* 在小屏幕设备上进行样式调整 */ body { padding: 10px; } h1 { font-size: 24px; } #result { padding: 10px; } } 浏览器信息检测 function detectBrowserEngine() { var userAgent = navigator.userAgent.toLowerCase(); var engine = ""; if (userAgent.indexOf("trident") !== -1) { engine = "Trident"; } else if (userAgent.indexOf("edge") !== -1) { engine = "EdgeHTML"; } else if (userAgent.indexOf("webkit") !== -1) { engine = "WebKit"; } else if (userAgent.indexOf("gecko") !== -1 && userAgent.indexOf("like gecko") === -1) { engine = "Gecko"; } else if (userAgent.indexOf("presto") !== -1) { engine = "Presto"; } else if (userAgent.indexOf("iphone") !== -1 || userAgent.indexOf("ipad") !== -1 || userAgent.indexOf("ipod") !== -1) { return "iOS"; } else if (userAgent.indexOf("android") !== -1) { return "Android"; } else if (userAgent.indexOf("windows phone") !== -1 || userAgent.indexOf("windows mobile") !== -1) { return "Windows Phone"; } else { return "Unknown"; } return engine; } function getIPAddress() { return fetch('https://api.ipify.org?format=json') .then(response => response.json()) .then(data => data.ip) .catch(error => { return Promise.reject(error); }); } function getIPDetails(ip) { return fetch('https://ipapi.co/' + ip + '/json/') .then(response => response.json()) .then(data => { data.ip = ip; return data; }) .catch(error => { return Promise.reject(error); }); } function formatDateTime(date) { var year = date.getFullYear(); var month = String(date.getMonth() + 1).padStart(2, '0'); var day = String(date.getDate()).padStart(2, '0'); var hours = String(date.getHours()).padStart(2, '0'); var minutes = String(date.getMinutes()).padStart(2, '0'); var seconds = String(date.getSeconds()).padStart(2, '0'); return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; } function displayBrowserInfo() { var resultElement = document.getElementById("result"); // 获取浏览器内核和版本 var engine = detectBrowserEngine(); var version = navigator.appVersion; // 获取操作系统和位数 var os = navigator.platform; var bit = detectOSBit(); // 获取完整用户代理字符串 var ua = navigator.userAgent; // 获取访问者IP地址 getIPAddress() .then(ip => { return getIPDetails(ip); }) .then(details => { var address = [details.country, details.regionName, details.city].filter(Boolean).join(", "); resultElement.innerHTML = "操作系统:" + os + "(" + bit + ")" + "浏览器内核:" + engine + "" + "版本信息:" + version + "" + "完整代码(UA):" + ua + "" + "来访IP:" + details.ip + "" + "所属地址:" + address + "" + "时间:" + formatDateTime(new Date()); }) .catch(error => { resultElement.innerHTML = "操作系统:" + os + "(" + bit + ")" + "浏览器内核:" + engine + "" + "版本信息:" + version + "" + "完整代码(UA):" + ua + "" + "无法获取来访IP" + "时间:" + formatDateTime(new Date()); }); } function detectOSBit() { var userAgent = navigator.userAgent.toLowerCase(); var osBit = ""; if (userAgent.indexOf("macintosh") !== -1) { if (userAgent.indexOf("intel") !== -1) { osBit = "64位"; } else { osBit = "32位"; } } else if (userAgent.indexOf("windows") !== -1) { if (userAgent.indexOf("wow64") !== -1 || userAgent.indexOf("win64") !== -1) { osBit = "64位"; } else { osBit = "32位"; } } else if (userAgent.indexOf("linux") !== -1) { if (userAgent.indexOf("x86_64") !== -1 || userAgent.indexOf("x86-64") !== -1 || userAgent.indexOf("amd64") !== -1) { osBit = "64位"; } else { osBit = "32位"; } } return osBit; } window.onload = displayBrowserInfo;