Q285 How do I detect what screen resolution a browser is using?
You are here: irt.org | FAQ | JavaScript | Screen | Q285 [ previous next ]
In Netscape Navigator 4 and Internet Explorer 4 there are new properties that give you better access to the screen/window dimensions.
Netscape Navigator 4:
- screen.availHeight - Specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
- screen.availWidth - Specifies the width of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the Taskbar on Windows.
- screen.colorDepth - The bit depth of the color palette, if one is in use; otherwise, the value is derived from screen.pixelDepth.
- screen.height - Display screen height.
- screen.pixelDepth - Display screen color resolution (bits per pixel).
- screen.width - Display screen width.
- window.innerHeight - Specifies the vertical dimension, in pixels, of the window's content area.
- window.innerWidth - Specifies the horizontal dimension, in pixels, of the window's content area.
- window.outerHeight - Specifies the vertical dimension, in pixels, of the window's outside boundary.
- window.outerWidth - Specifies the horizontal dimension, in pixels, of the window's outside boundary.
- window.pageXOffset - Provides the current x-position, in pixels, of a window's viewed page.
- window.pageYOffset - Provides the current y-position, in pixels, of a window's viewed page.
Microsoft Internet Explorer 4:
- screen.bufferDepth - Specifies an offscreen bitmap buffer.
- screen.colorDepth - Returns the bits-per-pixel value used for colors on the destination device or buffer.
- screen.height - Returns the vertical resolution of the screen, in pixels.
- screen.updateInterval - Sets or retrieves the update interval for the screen.
- screen.width - Specifies the horizontal resolution of the screen, in pixels.
©2018 Martin Webb