Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

server variables

Status
Not open for further replies.

TruthInSatire

Programmer
Aug 12, 2002
2,964
US
I'd like to get the res of the screen of the user but
response.write(request.serverVariables("HTTP_UA_PIXELS")) desn't work any ideas why?
 
[tt]
Are you doing this to redirect the user to another screen size?

<%=Tony%>
€ € € € € € € € € €
 
I don't think thats a standard Server Variable that the client passes. I have seen screen resolution passed from some of the newer handhelds, but not from a standard browser. And thats the first time I have seen that server variables before, usually with the handhelds the resoution is embeddedin the browser type header.

-Tarwn ________________________________________________________________________________
Sometimes it is how you ask the question: faq333-2924
Many ASP questions have already been answered, please check faq333-3048 and use the search tool before posting
 
Put this in your ASP file to get a list of all your available Server Variables and their values...
Code:
<%
Dim item

For Each item in Request.ServerVariables
  Response.Write item & &quot; : &quot; & Request.ServerVariables(item) & &quot;<BR>&quot; & vbcrlf
Next
%>
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
[tt]
And if you need to find out the client's resolution in order to format your page correctly both this scripts should help you:


Script1
<script language=&quot;JavaScript&quot;>
var s800x600page = &quot;index1.htm&quot;;
var s1024x768page = &quot;index2.htm&quot;;
var s1152x864page = &quot;index3.htm&quot;;
var pagetype;
if ((screen.height == 600) && (screen.width == 800)) {
pagetype = 1; }
else if ((screen.height == 768) && (screen.width == 1024)) {
pagetype = 2; }
else if ((screen.height == 864) && (screen.width == 1152)) {
pagetype = 3; }
else {
pagetype = 3; }
if (pagetype == 1) { window.location.href = s800x600page }
else if (pagetype == 2) { window.location.href = s1024x768page }
else if (pagetype == 3) { window.location.href = s1152x864page }
//-->
</script>



Script2
<script>
if ((screen.width < 1024) && (screen.height < 768)) {
agree = confirm(&quot;Because your screen resolutions is set to &quot;+screen.width+&quot;x&quot;+screen.height+&quot;. This page may not display as intended. Press OK if you wish to continue...&quot;);
if (!agree) history.go(-1);
}
//-->
</script>


<%=Tony%>
€ € € € € € € € € €
 
Well I did a search for it and found the variable listed in a few sites below. then from I found a little paragraph at the bottom stating:

Above is a table of all the cool things you have access to via the Request.ServerVariables collection. Now, I know what you're thinking: &quot;What do server variables have to do with any of this information?&quot; Well, I don't know, but what I do know is that all of the HTTP header information that is sent by the client's browser to your server is available via this collection. You did catch that part about the client's browser....yes folks, some of these variables are browser specific! Luckily most of them are pretty well standardized. Just don't go using something like &quot;HTTP_UA_PIXELS&quot; and you'll be fine (It only works in old versions of IE!).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top