Link to home
Start Free TrialLog in
Avatar of simi
simi

asked on

reading screen size

Hi,

I want to read the screen resolution via javascript and send it to the server, then use it on the server side to size an applet.

Thanks.
Avatar of peteyhiggins
peteyhiggins

Try using screen.height and screen.width
good script. check it
cheers
umesh

<HTML>
<BODY>

<CENTER>
<SCRIPT LANGUAGE="JavaScript">

var screen_width = null;
var screen_height = null;
var resolution = null;
if (navigator.javaEnabled()) {
var toolkit = java.awt.Toolkit.getDefaultToolkit();
var screen_size = toolkit.getScreenSize();
screen_width = screen_size.width;
screen_height = screen_size.height;
resolution = toolkit.getScreenResolution();
}
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
if ((screen_width != null)
&& (screen_height != null)
&& (resolution != null)) {
document.write('<center><h1>Monitor Details:</h1><br><hr><br>');
document.write('Screen Width:  '+screen_width+'<BR>');
document.write('Screen Height:  '+screen_height+'<BR>');
document.write('Screen Resolution: '+resolution+'<BR>');
document.write('</center>');
}
else {
document.write('<center><P>');
document.write('I am sorry but we could not determine<P>');
document.write('the details of this screen.  You might<P>');
document.write('not have Java enabled in this browser.<P>');
document.write('</center>');
}
</SCRIPT>
</CENTER>
what about
document.body.clientHeight and document.body.clientWidth

this will give you the inner width of the viewable area of the browser
ASKER CERTIFIED SOLUTION
Avatar of steve-e-b
steve-e-b

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial