Created
May 28, 2024 14:05
-
-
Save alevgenk/98067583379354637c4c5d509f3c8c6d to your computer and use it in GitHub Desktop.
Get some browser detail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getMyBrowserDetails = async () => { | |
async function myIP() { | |
let response = await fetch("https://api.db-ip.com/v2/free/self"); | |
return await response.json() | |
} | |
const ipData = await myIP() | |
return { | |
ip: ipData.ipAddress, | |
accept_header: "*/*", | |
java_enabled: navigator.javaEnabled(), | |
language: navigator.language, | |
color_depth: screen.colorDepth, | |
screen_height: screen.height, | |
screen_width: screen.width, | |
window_height: document.body.clientHeight, | |
window_width: document.body.clientWidth, | |
time_zone_offset: new Date().getTimezoneOffset(), | |
time_zone_name: Intl.DateTimeFormat().resolvedOptions().timeZone, | |
user_agent: navigator.userAgent, | |
} | |
} | |
console.table( | |
await getMyBrowserDetails() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment