tags:

views:

271

answers:

4

Hello

Does anyone know how to get the screen height in a Perl CGI script? I know that Perl is a server-side language but is there any way to get the screen height (pixels) of the users screen?

Thanks

+4  A: 

Do you mean getting the height of the user's browser window?

There's no way to get that information without using some Javascript.

I would use Javascript/CSS to control presentation (like width and height), not the backend language.

lost-theory
Yes I want to get the height of the user's window. I guessed that JavaScript was the solution although I didn't know if Perl could handle that. I'll try with the screen.height of JavaScript Thanks
VictorLM
+1  A: 

well, you can use js to set a cookie of the height then in next request, use Perl CGI to get the cookie.

do remember, you will not get the height in the first visit.

Thanks.

Fayland Lam
+1  A: 

I would recommend reading up this Howtocreate article

There are different interpretations of a window height/width, and you should know these quirks.

Deefjuh
Good tutorialThanks
VictorLM
A: 

Sure , make an ajax request with either XMLHttpRequest or jQuery (or whatever other framework you prefer) and send window.innerHeight to your server

xxxxxxx