Last active
May 12, 2020 20:22
-
-
Save mrothNET/9a4c677a81b87480ac3d55d476b4e93d to your computer and use it in GitHub Desktop.
Quick'n'dirty browser info (Javascript)
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Browser Info</title> | |
</head> | |
<body> | |
<h1>Browser Info</h1> | |
<div id="info"></div> | |
<script> | |
const info = document.getElementById("info"); | |
function addElement(tagName, text) { | |
const element = document.createElement(tagName); | |
element.innerText = text; | |
info.appendChild(element) | |
} | |
function addInfo(name) { | |
addElement("h2", name); | |
addElement("pre", navigator[name]); | |
} | |
["platform", "userAgent", "appVersion"].forEach(addInfo); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment