Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active October 26, 2017 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noitidart/840c61bd1fb7eb56d2e69bf71038bb7a to your computer and use it in GitHub Desktop.
Save Noitidart/840c61bd1fb7eb56d2e69bf71038bb7a to your computer and use it in GitHub Desktop.
{
"ACCEPT": "application/json",
"ACCEPT_ENCODING": "gzip",
"ACCEPT_LANGUAGE": "en-US",
"CONNECTION": "Keep-Alive",
"CONTENT_TYPE": "application/json",
"HOST": "www.whatismybrowser.com",
"USER_AGENT": "okhttp/3.6.0"
}
{
"ACCEPT": "application/json",
"ACCEPT_ENCODING": "gzip",
"ACCEPT_LANGUAGE": "en-US",
"CONNECTION": "Keep-Alive",
"CONTENT_TYPE": "application/json",
"HOST": "www.whatismybrowser.com",
"USER_AGENT": "okhttp/3.6.0"
}
(async function() {
const res = await fetch('https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending')
const text = await res.text();
const patt = /<th>([\s\S]*?)<\/th>[\s\S]*?<td>([\s\S]*?)<\/td>/mg;
const headers = {};
let match;
while (match = patt.exec(text)) {
const [, key, value] = match;
headers[key] = value;
}
alert(JSON.stringify(headers));
// const info = [];
// for (const p in DeviceInfo) {
// try {
// info.push(`${p}: "${DeviceInfo[p]()}"`);
// } catch (ignore) {}
// }
// alert(info.join('\n'));
})()
@Noitidart
Copy link
Author



(async function() {
    const res = await fetch('https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending')
    const text = await res.text();

    const patt = /<th>([\s\S]*?)<\/th>[\s\S]*?<td>([\s\S]*?)<\/td>/mg;
    const headers = {};
    let match;
    while (match = patt.exec(text)) {
        const [, key, value] = match;
        headers[key] = value;
    }
    alert(JSON.stringify(headers));

    const info = [];
    const pBad = ['getIPAddress', 'getMACAddress', 'isPinOrFingerprintSet', 'getPhoneNumber'];
    for (const p in DeviceInfo) {
        if (pBad.includes(p)) continue;
        info.push(`${p}: "${DeviceInfo[p]()}"`);
    }
    alert(info.join('\n'));
})()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment