Monitor resolution

G

Grant Wagner

Mario said:
How to get monitor resolution using javascript?

The question you should be asking is why you want to do this.

The resolution of the "monitor" has only a passing relationship
with the dimensions of the Web browser. It simply defines what
might be the maximum possible *outer* dimensions of the browser
window.

It tells you nothing about how big the *viewport* on the browser
is. Given the ability of browsers with customizable toolbars the
viewport could be anything from a few pixels smaller then the
outer dimensions of the browser to hundreds of pixels smaller (I
once saw a user using Internet Explorer with about 8 toolbars,
their viewport was perhaps 1/3 of the overall height of the outer
dimensions of the Web browser window).

For people with multiple monitor configurations, the dimensions
you retrieve might be the size of all monitors both horizontally
and vertically, not very useful because it's highly unlikely
anyone with 2 or more monitors would maximize a Web browser
across all of their monitors.

If your idea is to "maximize the user's browser for them", this
is an _extremely_ bad idea.

First, it's more and more likely attempting to do such a thing is
simply going to fail due to browser add-ons or built-in ability
to ignore such requests.

Second, people with 2 or more monitors might not appreciate you
spreading their browser window over all their displays (of
course, anyone with 2 or more monitors probably disable your
ability to resize the browser in the first place).

Third, it's really really really RUDE to mess with the user's
browser dimensions. It shows a lack of respect for your visitors
and somehow implies you know better then they do.

All that said, if you want this information for survey purposes
or some other reason, you can retrieve the size of the available
desktop area using:

screen.width and screen.height

To obtain the area of the desktop available to actually display
windows in (minus any taskbars or toolbars) its:

screen.availWidth and screen.availHeight
 
T

Thomas 'PointedEars' Lahn

Mario said:
How to get monitor resolution using javascript?

You cannot and even if you could, what would it serve anyway?
Display resolution != desktop size != browser window size != viewport size.
[psf 3.7]


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top