JavaScript DHTML/Development/System Properties
Get user"s operating system information
<source lang="html4strict">
<html> <head> <script type="text/javascript"> function yourOS() {
var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("win") != -1) { return "Windows"; } else if (ua.indexOf("mac") != -1) { return "Macintosh"; } else if (ua.indexOf("linux") != -1) { return "Linux"; } else if (ua.indexOf("x11") != -1) { return "Unix"; } else { return "Computers"; }
} </script> <body>
Welcome to GiantCo Computers</h2>
We love
<script type="text/javascript">document.write(yourOS())</script>
<noscript>Computers</noscript>
Users!
</body> </html>
</source>
OS (Operating system) name
<source lang="html4strict">
var isWin = (navigator.userAgent.indexOf("Win") != -1);
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var isUnix = (navigator.userAgent.indexOf("X11") != -1);
<script language="JavaScript" type="text/javascript"> document.write("<style type="text/css">"); document.write("body {font-size:" + ((isMac) ? "12" : "10") + "pt}"); document.write("</style>"); </script>