General discussion

Locked

Getting users Screen Resolution

By troylh ·
I've been looking for the past week for a way to find out when someone comes to my web page what their screen resolution is, etc. in CGI/Perl.
What I think is needed is to run a Java script, then pass that variable to CGI/Perl.
Can some please email me some simple code that will show me how to do this?
Here is my URL: http://linux-serv.mendocino.cc.ca.us/~thammack/ Click on "Final Project"

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Getting users Screen Resolution

by eSadacca In reply to Getting users Screen Reso ...

This script will get you the user's screen resolution. The first line is IE only; the second works in both IE and Netscape.

<script language="JavaScript1.2">
if (window.screen)
{
document.write('screen.Width x screen.Height: '+screen.Width+'x'+screen.Height+'<br>');
document.write('screen.availWidth x screen.availHeight: '+screen.availWidth+'x'+screen.availHeight+'<br>');
}
</script>

Collapse -

Getting users Screen Resolution

by troylh In reply to Getting users Screen Reso ...

Poster rated this answer

Collapse -

Getting users Screen Resolution

by fgarber In reply to Getting users Screen Reso ...

The following works fine.
<script language="JavaScript">
<!--
var width = screen.width;
var height = screen.height;
//-->
</script>
You can use the variables width and height to set the size of fonts, the screen available height and width or anything else you want to control according to their screen size.

Collapse -

Getting users Screen Resolution

by troylh In reply to Getting users Screen Reso ...

How can I use Java in CGI/Perl?

Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums