Posted by : Deepak Vasudevan Tuesday, October 07, 2008

Graceful Presentation of Web Pages in Different Screen Resolutions

The greatest problem that confronts any webmaster is that his website should be able to render in a diversity of web browsers with plethora of screen resolutions. There are plenty ways of having our web pages complying to the different resolutions by way of CSS. But there are occasions, when our application develops an enhanced level of affinity to a particular resolution say 1024x764. In those cases, we are pressed into a situation of detecting the resolution of the user and advising him that our application is geared to support only a specific resolution.

How-To Detect Resolution in Javascript?

There is a simpler way to detect screen resolution in JavaScript.

<Script Language='JavaScript'>
alert ("Your screen dimensions are " + screen.availWidth + " and " + screen.availHeight);
</Script>

Based upon the values returned by availWidth and availHeight, you can do further comparisons and alert the user accordingly.

Popular Post

Blogger templates

Labels

Blog Archive

Followers

Blog Archive

Powered by Blogger.

- Copyright © Lavanya Deepak -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -