By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,775 Members | 1,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,775 IT Pros & Developers. It's quick & easy.

Get maximium width and height of the screen

P: 8
Hi all, i want to get the maximum width and height of the screen. could anyone telll me the right coding for this
Feb 16 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 5,058
I'm not sure if you can do that with php.

PHP is run server side so it only gets limited info about the client. Browser type and such.

I would consider using javascript for this kind of thing.
Feb 16 '07 #2

P: 17
yes you are right we can't do in php use javascript

check the below code


[HTML]<script type="text/javascript">

width = screen.width;
height = screen.height;

if (width > 0 && height >0) {
window.location.href = "http://localhost/main.php?width=" + width + "&height=" + height;
} else


part-2 php (main.php)
echo "<h1>Screen Resolution:</h1>";
echo "Width : ".$_GET['width']."<br>";
echo "Height : ".$_GET['height']."<br>";

I hope this would solve the problem
Feb 16 '07 #3

P: 8
Thank a lot. its working....
Mar 2 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.