生成设备唯一UUID
function generateDeviceID() { const navigatorInfo = window.navigator; const screenInfo = window.screen; const uid = navigatorInfo.mimeTypes.length; const ab = navigatorInfo.userAgent.replace(/\D+/g, ""); const version = navigatorInfo.appVersion.replace(/\D+/g, ""); const versionNum = screenInfo.height || ""; const screenSize = screenInfo.width + screenInfo.height; return uid + ab + version + versionNum + screenSize; } const uniqueId = localStorage.getItem("uuid"); if (!uniqueId) { const deviceID = generateDeviceID(); localStorage.setItem("uuid", deviceID); }