Obtendo informações do Browser: javascript

Os scripts abaixo permitem obter as mais diversas informações do browser.


Retirado de http://www.csgnetwork.com/directbrowsersnippets.html


AppName
<script language="JavaScript"><!--
document.write("AppName: " + navigator.appName);
//-->
</script>
AppVersion
<script language="JavaScript"><!--
document.write("AppVersion: " + navigator.appVersion);
//-->
</script>
UserAgent
<script language="JavaScript"><!--
document.write("UserAgent: " + navigator.userAgent);
//-->
</script>
Platform
<script language="JavaScript"><!--
if (navigator.platform) {
  document.write("Platform: " + navigator.platform);
  }
//-->
</script>
JavaScriptVersion
<script language="JavaScript"><!--
JavaScriptVersion = 10;
//-->
</script>
<script language="JavaScript1.1"><!--
JavaScriptVersion = 11;
//-->
</script>
<script language="JavaScript1.2"><!--
JavaScriptVersion = 12;
//-->
</script>
<script language="JavaScript1.3"><!--
JavaScriptVersion = 13;
//-->
</script>
<script language="JavaScript1.4"><!--
JavaScriptVersion = 14;
//-->
</script>
<script language="JavaScript"><!--
document.write("JavaScriptVersion: " +
  JavaScriptVersion);
//-->
</script>
Java
<script language="JavaScript"><!--
if (JavaScriptVersion >= 11) {
  if (navigator.javaEnabled() == true) {
      document.write("Java: enabled");
    } else {
      document.write("Java: disabled");
      }
  }
//-->
</script>
ScreenWidth
<script language="JavaScript"><!--
if (JavaScriptVersion >= 12) {
  document.write("ScreenWidth: " + screen.width);
  }
//-->
</script>
ScreenHeight
<script language="JavaScript"><!--
if (JavaScriptVersion >= 12) {
  document.write("ScreenHeight: " + screen.height);
  }
//-->
</script>
InnerWidth
<script language="JavaScript"><!--
if (JavaScriptVersion >= 12) {
  Browser = navigator.appName;
  if (navigator.appName.substring(0,9)
    == "Microsoft") Browser = 'MSIE';
  if (Browser != 'MSIE') {
      document.write("InnerWidth: " + innerWidth);
    } else {
      document.write("InnerWidth: " +
        document.body.clientWidth);
      }
  }
//-->
</script>
InnerHeight
<script language="JavaScript"><!--
if (JavaScriptVersion >= 12) {
  Browser = navigator.appName;
  if (navigator.appName.substring(0,9)
    == "Microsoft") Browser = 'MSIE';
  if (Browser != 'MSIE') {
      document.write("InnerHeight: " + innerHeight);
    } else {
      document.write("InnerHeight: " +
        document.body.clientHeight);
      }
  }
//-->
</script>
Colors
<script language="JavaScript"><!--
if (JavaScriptVersion >= 12) {
  Browser = navigator.appName;
  if (navigator.appName.substring(0,9)
    == "Microsoft") Browser = 'MSIE';
  if (Browser != 'MSIE') {
      document.write("Colors: " + screen.pixelDepth);
    } else {
      document.write("Colors: " + screen.colorDepth);
      }
  }
//-->
</script>
Layers
<script language="JavaScript"><!--
if ((document.all) || (document.layers)) {
    document.write("Layers: yes");
  } else {
    document.write("Layers: no");
    }
//-->
</script>
Plugins
<script language="JavaScript"><!--
if (navigator.plugins) {
  for (i = 0; i < navigator.plugins.length; i++) {
    document.write("Plugin " + i + ": " +
      navigator.plugins[i].name + "<br>");
    }
  }
//-->
</script>
Referrer
<script language="JavaScript"><!--
if (document.referrer) {
  document.write("Referrer: " + document.referrer);
  }
//-->
</script>
Time on your computer
<script language="JavaScript"><!--
document.write("Time on your computer: " + Date());
//-->
</script>
Resultados






























Have fun ;)

Comentários

Postagens mais visitadas deste blog

Detectar o encoding de um arquivo para não corromper ao transformá-lo

erro "ora-12154: tns: não foi possível resolver o identificador de conexão especificado"

Quebras de linha no Delphi 2010