I want to get the screen resolution from the client-side. I have the Javascript code and it works find. Could someone please tell me how I can get the variables returned in this script into a server control (textbox, label.control) I was told to put it into
an html control. I want it sent back to a server control. thx you much. <script language="JavaScript" type="text/JavaScript"> var screenW = 640, screenH = 480; if (parseInt(navigator.appVersion)>3) { screenW = screen.width; screenH = screen.height; } else
if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled() ) { var jToolkit = java.awt.Toolkit.getDefaultToolkit(); var jScreenSize = jToolkit.getScreenSize(); screenW = jScreenSize.width; screenH = jScreenSize.height;
} document.write( "Screen width = "+screenW+"
" +"Screen height = "+screenH ) </script>
I know and I'm thankful, but I can't get to. I still don't understand the solution you provided. I can get it to work. Could you please tell to me like I'm a 5year old. ;o) Bill
OK. what that line does is to cause the browser to move on to /newfile.aspx (or whatever page you specify) and pass it the heigth and width variables in the Request.QueryString collection simply make sure that you store or otherwise use the variables Request.QueryString["sw"];
Request.QueryString["sh"]; when newfile.aspx loads. if you stash these vars away you'll only need to perform the check once, and you could also extend it to pass other properties along if you need them later. this, in effect, is what BrowserHawk does (www.browserhawk.com)
though obviously BH does it all for you.
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
ChillBill
Member
230 Points
46 Posts
Easy Javascript Question
Nov 06, 2003 03:37 PM|LINK
" +"Screen height = "+screenH ) </script>
Atrax
All-Star
18705 Points
3733 Posts
Re: Easy Javascript Question
Nov 07, 2003 01:01 AM|LINK
Jason Brown - MVP, IIS
ChillBill
Member
230 Points
46 Posts
Re: Easy Javascript Question
Nov 07, 2003 01:25 PM|LINK
ChillBill
Member
230 Points
46 Posts
Re: Easy Javascript Question
Nov 07, 2003 01:34 PM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: Easy Javascript Question
Nov 09, 2003 01:17 AM|LINK
Jason Brown - MVP, IIS