Good info Peter.

As a side note too, this group is about "beginners", or basic perl, or those
things pertaining to perl that we all need help on every now and then.  I
don't think the focus is CGI programming per se, but perl in general.  It's a
great group, and I personally have benefited tremendously from it! :)

-Jeff


--- Peter Kappus <[EMAIL PROTECTED]> wrote:
> Hi Lou,
>       Yes, as Jeff pointed out, if you're running it from a console,
> system("stty -a") should give you the rows/columns and a bunch of other
> usefull stuff.  If, however, you're talking about screen resolution and
> you're running your script as a CGI and sending the results to a browser
> (which is what this list is all about ;-)  Then you're going to have to do
> some fancy JavaScripting to capture the screen resolution, etc.
> 
> Basically, you create hidden form fields in a form on your page and then
> use
> javascript to populate them once the page gets rendered on the client's
> side.  (Un)fortunately, the only way to get this info is when the client
> submits a form.
> 
> 
> for example, I might have a form on my login page that looks like this:
> 
> <form name="LoginForm">
> <input type="hidden" value="ScreenWidth"/>
> <input type="hidden" value="ScreenHeight"/>
> <input type="hidden" value="ColorDepth"/>
> username: <input type="text" name="username"/>
> <BR/>
> password: <input type="passwd" name="pass"/>
> <input type="button" onClick="doSubmit()"/>
> </form>
> 
> then in the header I'd need a js function "onSubmit" like this:
> 
> <script language='javascript'>
> 
> function doSubmit(){
>       var elements = document.forms.LoginForm.elements;
>       elements.ScreenWidth.value = window.screen.width;
>       elements.ScreenHeight.value = window.screen.height;
>       elements.ColorDepth.value = window.screen.colorDepth;
>       
>       //some other form validation....
> 
>       //submit!
>       document.forms.LoginForm.submit();
> }
> 
> </script>
> 
> 
> 
> In my CGI, I can capture this using the standard CGI params methods...
> 
> use GGI qw/:standard/;
> 
> print "Content-type: text/html\n\n";
> 
> print "screenWidth: " . param("ScreenWidth");
> print "<BR>screenHeight: " . param("ScreenHeight");
> 
> etc...
> 
> NOTE:  this is untested and yes, I just ripped it off of "mailblocks.com" 
> 
> If this makes no sense, try to learn a little more about hidden form
> variables and javascript first....then figure out how to get it into your
> CGI.
> 
> 
> good luck,
> -Peter
> 
> 
> -----Original Message-----
> From: Luinrandir Hernsen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 27, 2003 11:08 AM
> 
> how do I find the current screen size of someone running my perl program?
> many thanks
> Lou
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to