javascript res detector...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamslam
    Senior Member
    • Mar 2003
    • 293
    • 3.0.7

    javascript res detector...

    Can anyone here give me a javascript to detect the res of one's computer? My home page site is specifically designed for 800x600, and looks like crap on a bigger resolution. So I'd like to detect their settings, and give them an alert.

    I think it's SOMETHING like this..

    Code:
    if (width > 800 && height > 600) {
    alert("Blah blah");
    }
    i'm not entirely sure though, i'm a little rusty on javascript too, any help would be appreciative

    Thanks

    -jamslam
    http://www.webtrickscentral.com/images/wtcsig.jpg
  • jamslam
    Senior Member
    • Mar 2003
    • 293
    • 3.0.7

    #2
    nevermind, i figured it out...

    I was just thinking logically and thought that the javascript didn't know what the width and height was, so i used screen.width, and it works...
    http://www.webtrickscentral.com/images/wtcsig.jpg

    Comment

    • Marco
      Senior Member
      • Nov 2000
      • 827
      • 3.8.x

      #3
      Yeah, simple enough.

      Code:
      <script type="text/javascript">
      <!--
      if (!(screen.width == 800))
      {
       alert ('Moo!');
      }
      //-->
      </script>

      Comment

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