Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get browser window size/resolution with PHP

I have a page that starts with a navigation bar, with specific height, and under that I placed a code that should fill out the rest of the height. How could I code it for various resolutions? I need the "working area" size of the browser.

like image 430
Pmillan Avatar asked Dec 10 '11 20:12

Pmillan


2 Answers

$window_width = "<script type='text/javascript'>document.write(window.innerWidth);</script>";

like image 140
Peter Avatar answered Sep 22 '22 00:09

Peter


Cannot be done with PHP. Even if it could, this CSS is a far better solution.

You have encountered the most annoying CSS problem in existence. There seems to be as many answers to this question as there are people asking it. The above link is the best, most cross-browser friendly solution I have found for this issue.

Don't let the part about the footer confuse you. If you don't want a footer, it will still work perfectly.

like image 32
Scott Greenfield Avatar answered Sep 22 '22 00:09

Scott Greenfield