...

View Full Version : Detect Screen Resolution



ubik
01-23-2006, 07:54 AM
Hello, Greetings.

Does anyone know if there is anyway to detect the user's Screen Resolution using javascript? I have noticed that:


screen.width

works good with Internet Explorer but not in firefox, and im not even sure about any other browser

glenngv
01-23-2006, 08:07 AM
That works in Firefox. To quickly test it, type this in the FF address bar:

javascript:alert(screen.width)

felgall
01-23-2006, 08:09 PM
Of course screen resolution tells you nothing about the space available in the browser window to display the web page.

ubik
01-24-2006, 08:45 AM
That works in Firefox. To quickly test it, type this in the FF address bar:

javascript:alert(screen.width)

I noticed that Internet Explorer when on 800x600 resolution returns 800 width, when on 1024x768 resolution it returns 1024width.. But firefox, no matter what resolution I have my screen set to It always returns 800 ??

glenngv
01-24-2006, 09:23 AM
Did you try that simple test on the address bar itself? What FF version are you using? I'm using FF 1.5 and it returns the correct width. And I'm sure it returns the same with older versions.

ubik
01-24-2006, 09:21 PM
Ah yes, I just downloaded Mozilla Firefox 1.5 and it works now. But still i guess the script wouldnt be suitable because of all the people out there still using FF1.0 I wanted to make a script to detect screen resolution and redirect to specific resolution designs, but i guess ill be forced to make a splash page now. Fluid or liquid layouts are alright but my designs are highly graphical interfaced in width with no room for CSS textures. I would still use the script if it wasnt for Firefox 1.0, its not that it doesnt support the script, its just that it detects the resolution incorrectly if its anything other than 800 width.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum