Skip to content

Instantly share code, notes, and snippets.

@mrothNET
Last active May 12, 2020 20:22
Show Gist options
  • Save mrothNET/9a4c677a81b87480ac3d55d476b4e93d to your computer and use it in GitHub Desktop.
Save mrothNET/9a4c677a81b87480ac3d55d476b4e93d to your computer and use it in GitHub Desktop.
Quick'n'dirty browser info (Javascript)
<!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