Simple code to detect screen resolution

Here is a simple DOM (document object model) based code to direct client’s screen resolution, pixel depth , orientation and bit rate.simple javascript coding to detect screen resolution

Screen pixel depth:

<script type=”text/javascript”>
document.write(window.screen.pixelDepth);
</script>

Screen resolution:

<script type=”text/javascript”>
document.write(screen.width+’x’+screen.height);
</script>

Available height:

<script>
document.write(screen.availHeight);
</script>

Available width:

<script>
document.write(screen.availWidth);
</script>

Bit depth:

<script type=”text/javascript”>
document.write(window.screen.colorDepth);
</script>

Screen orientation:

<script type=”text/javascript”>
if(screen.availWidth > screen.availHeight){
document.write(“landscape”);
}
else{
document.write(“portrait”);
}
</script>

Output as per your system

  1. Screen pixel depth:
  2. Screen resolution:
  3. Available height:
  4. Available width:
  5. Bit depth:
  6. Screen orientation:

Leave a Reply

Your email address will not be published. Required fields are marked *