<h1></h1>
<p></p>
h1,p {
  color: white;
  text-align: center;
}

body {
  background-color: #282727;
}
View Compiled

// This is a combination of stuff found at the following sites:
// https://stackoverflow.com/a/19176790
// https://stackoverflow.com/a/21742107
// http://stackoverflow.com/a/9039885/177710
// https://stackoverflow.com/a/29657232
function getOsName(){
  var uA = navigator.userAgent || navigator.vendor || window.opera;
  
  if (/windows phone/i.test(uA)) {
    return "Windows Phone";
  }
  if (/android/i.test(uA)){
    return "Android";
  }
  if (/iPad|iPhone|iPod/.test(uA) && !window.MSStream){
    return "iOS";
  }
  if (uA.indexOf("Windows NT 10.0")!= -1){
    return "Windows 10";
  }
  if (uA.indexOf("Windows NT 6.3") != -1){
    return "Windows 8.1";
  }
  if (uA.indexOf("Windows NT 6.2") != -1){
    return "Windows 8";
  }
  if (uA.indexOf("Windows NT 6.1") != -1){
    return "Windows 7";
  }
  if (uA.indexOf("Windows NT 6.0") != -1){
    return "Windows Vista";
  }
  if (uA.indexOf("Windows NT 5.1") != -1){
    return "Windows XP";
  }
  if (uA.indexOf("Windows NT 5.0") != -1){
    return "Windows 2000";
  }
  if (uA.indexOf("Mac") != -1){
    return "Mac";
  }
  if (/\bCrOS\b/.test(uA)){
    return "Chrome OS";
  }
  if (uA.indexOf("Linux") != -1 && uA.indexOf("Ubuntu") != -1){
    return "Ubuntu";
  }
  if (uA.indexOf("Linux") != -1){
    return "Linux";
  }
  if (uA.indexOf("X11") != -1){
    return "UNIX";
  }
  return "Unknown";
}

function getStringToDisplay(){
  var s = getOsName();
  var tRet = " An Unknown Operating System.";
  if (s === "Android"){
    tRet = " Android.";
  }
  if (s === "iOS"){
    tRet = " iOS.";
  }
  if (s === "Mac"){
    tRet = " Mac.";
  }
  if (s === "Chrome OS"){
    tRet = " Chrome OS.";
  }
  if (s === "Ubuntu" || s === "Linux"){
    tRet = " Linux.";
  }
  if (s === "Windows 10" || s === "Windows 8.1" || s === "Windows 8" || s === "Windows 7" || s === "Windows Vista"){
    tRet = " Windows.";
  }
  return tRet;
}
document.getElementsByTagName("h1")[0].innerHTML = "*This device is running " + getStringToDisplay();
document.getElementsByTagName("p")[0].innerHTML = "*(Note that this method of operating system detection is not guaranteed to be correct, but since most people don't spoof their browser's user agent, it is quite likely to be correct.)";
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.