1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Is it possible to determine a visitor's monitor resolution setting using JavaScript?
  2. #2
  3. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    Hi Larry,

    I'll give you an example of a script which will check the screen width and then will load the specific HTML according to the screen resultion:

    function BrowserCheck()
    { width = window.screen.width;

    if (width == 1024)

    So window.screen.width refers to the horizontal amout of pixels ( most pc's are running 800x600 or 1024x768 )
    Running this script requires a JavaScript 1.2 browser though ( e.g. MSIE 4.0 )

    Hope this will help...
  4. #3
  5. No Profile Picture
    Ulf Wendel
    Devshed Newbie (0 - 499 posts)
    Hi Fas,

    I alway thought the mosts browser give you wrong results. Do you know a compability list of browsers not only supporting JavaScript 1.2 but also reporting correct values of the screen resolution?


  6. #4
  7. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    just copy and paste the following script into a new HTML document:

    <script language="JavaScript1.2">

    function Test()
    { width = window.screen.width;
    alert(width) }

    <input type="button" onClick="Test()">

    Clicking the button will show a javascript alert with the amount of horizontal pixels of your screen (most likely 800 or 1024)...

    I've tested it in both MSIE 4.0 and Netscape 4.5 and it worked fine!

    Grtz Fas

Similar Threads

  1. how to auto adjust resolution of web page??
    By tulip in forum ASP Programming
    Replies: 2
    Last Post: February 5th, 2004, 08:17 AM
  2. Changing video resolution from 1280 X 1024 to 1024 X 768
    By linh in forum Visual Basic Programming
    Replies: 4
    Last Post: January 21st, 2004, 01:46 PM
  3. How to resize frame according to screen resolution???
    By skuba in forum HTML Programming
    Replies: 10
    Last Post: January 5th, 2004, 05:51 PM
  4. display resolution setting problem in redhat 9.0
    By wzhou8 in forum Linux Help
    Replies: 7
    Last Post: December 29th, 2003, 12:54 PM
  5. help needed with a resolution problem
    By indecisive0 in forum Photoshop Help
    Replies: 6
    Last Post: November 25th, 2003, 11:21 PM

IMN logo majestic logo threadwatch logo seochat tools logo