Announcement

Collapse
No announcement yet.

Detecting Screen Resolution

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Detecting Screen Resolution

    How do you detect the screen resolution in HTML?

  • #2
    JavaScript will do.
    Code:
    <script type="text/javascript">
    <!--
    var thiswidth = screen.width;
    var thisheight = screen.height;
     
    alert("Your screen resolution is " + thiswidth + " by " + thisheight + " pixels!");
    //-->
    </script>
    Just what exactly do you want to use this for?
    You can ofcourse have it do more than just pop up an alert box, like have it print out different images depending on the resolution used (although that's not reliable at all since people can turn JavaScript off).

    Comment


    • #3
      Originally posted by Marco
      JavaScript will do.
      Code:
      <script type="text/javascript">
      <!--
      var thiswidth = screen.width;
      var thisheight = screen.height;
       
      alert("Your screen resolution is " + thiswidth + " by " + thisheight + " pixels!");
      //-->
      </script>
      Just what exactly do you want to use this for?
      You can ofcourse have it do more than just pop up an alert box, like have it print out different images depending on the resolution used (although that's not reliable at all since people can turn JavaScript off).
      Basically for future reference.

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X