Arun
Arun

Reputation: 1704

How to get screen resolution of a client system by using JavaScript

I am developing a website,my webpage consist of many products. on clicking over a product i must show the details of that product in popup window.For setting the popup window to full window, i want to get client system resolution, so that it may easy to show the popup window in full screen according to resolution. Can any one please help me to sort a way to solve this problem by using JavaScript or any other method.

Thanks in advance...

Upvotes: 1

Views: 1629

Answers (2)

Kranu
Kranu

Reputation: 2567

The Javascript variables screen.width and screen.height work well enough in most browsers.

You will however have to subtract a few pixels off the height for the title bar and what not.

Upvotes: 0

Pangolin
Pangolin

Reputation: 7444

To get the client's window dimensions with Javascript:

     var windowWidth = document.documentElement.clientWidth;
     var windowHeight = document.documentElement.clientHeight;

Upvotes: 2

Related Questions