If you want to do good WebPages that look good on different sizes of browser, you are probably going to need to send different pages from your server. However you need to know what the size of the browser is.

There are three files shown below that will give you some ideas about how to do it.

Click here to see them at work !!


<script language="JavaScript">

	function setUp () {
		document.thisform.Height.value = window.screen.height;
		document.thisform.Width.value = window.screen.width;
		document.thisform.Avail_Height.value = window.screen.availHeight;
		document.thisform.Avail_Width.value = window.screen.availWidth;


<body OnLoad="setUp()">

<H2>Get my info</H2>


<B>Thank you for visiting this page<BR><BR>
The purpose of it is to allow me to check if it is possible to get the information about the Browser a person is 
using. (Particularly the window size)<BR><BR>
The reason that I need it, is to try and ensure that I give the best and most appropriate pages for the particular 
Browser and Monitor being used.<BR><BR>
When you click on the button, I will show you exactly what I have recorded.<BR>
(If any of it causes you any concern, EMail me and I will delete it.<BR><BR><BR>
If you wish to tell me who you are, it would be useful to me only in so much as I would know who has helped me<BR>
if you don't wish to tell me I do not mind at all.<BR><BR>

<INPUT TYPE="TEXT" NAME="name"> Type your name in here<BR>

<INPUT TYPE=SUBMIT VALUE="Send the information"><BR><BR>

If you have several browsers, it would be helpful if you could do this on all of them</B>


You will see that it points to a file called recordit.asp - that file is shown below

<% @ LANGUAGE = VBScript %>
<% Option Explicit %>
<% ' Listing 12.1   Creating and Using a TextStream Object
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2 ' Opens the file using the system default.
Const TristateTrue = -1 ' Opens the file as Unicode.
Const TristateFalse = 0 ' Opens the file as ASCII.
Dim objFS, objTextS, strLine, Hourdef, BigHour, UniqueKey, UfileName, strFileName, TimeNow

 Application("countnumber") = Application("countnumber") + 1
 Hourdef = DateDiff("h",Now,#1/1/2002#)
 If Hourdef <> Application("Hourdef") Then
       Application("countnumber") = 1
 End If
 BigHour = Hourdef * 100000
 UniqueKey = BigHour + Application("countnumber")
 Application("Hourdef") = Hourdef
 UfileName = UniqueKey & ".inp"
 TimeNow = DateAdd("s",45,time)

Set objFS=Server.CreateObject("Scripting.FileSystemObject")
 strFileName= Server.MapPath("SIZEINFO.DAT")
If objFS.FileExists(strFileName) = True Then
Set objTextS = objFS.OpenTextFile(strFileName, ForReading, False, TristateFalse)
End If

	If objFS.FileExists(strFileName) = True Then
		Set objTextS = objFS.OpenTextFile(strFileName, ForAppending, False, TristateFalse)
		Set objTextS = objFS.CreateTextFile(strFileName,False, False)
	End If

	objTextS.WriteLine "**********"
	objTextS.WriteLine "Your Name is " & request.Form("name")
	objTextS.WriteLine "Your screen Height is " & request.Form("Height")
	objTextS.WriteLine "Your screen Width is " & request.Form("Width")
	objTextS.WriteLine "Your screen Available Height is " & Request.Form("Avail_Height")
	objTextS.WriteLine "Your screen Available Width is " & Request.Form("Avail_Width")
	objTextS.WriteLine Request.ServerVariables("ALL_RAW")
	objTextS.WriteLine Request.ServerVariables("QUERY_STRING")
	objTextS.WriteLine "Your IP Address is " & Request.ServerVariables("REMOTE_ADDR")
	objTextS.WriteLine "Your Referer is " & Request.ServerVariables("HTTP_REFERER")
	objTextS.WriteLine Request.QueryString("message")
	objTextS.WriteLine Request.Form("ALL_RAW")
	objTextS.WriteLine "The Time is " & time
	objTextS.WriteLine "The Date is " & date
	objTextS.WriteLine "The SessionID is " & Session("SessionID")
	objTextS.WriteLine "The Session Name is " & Session("name")
	objTextS.WriteLine "  "
	objTextS.WriteLine Now

 Response.Write "<HTML><BODY>"
 Response.Write "<BR><BR>"
 Response.Write "Your Name is " & Request.Form("name")
 Response.Write "<BR><BR>"
 Response.Write "Your screen Height is " & Request.Form("Height")
 Response.Write "<BR><BR>"
 Response.Write "Your screen Width is " & Request.Form("Width")
 Response.Write "<BR><BR>"
 Response.Write "Your screen Available Height is " & Request.Form("Avail_Height")
 Response.Write "<BR><BR>"
 Response.Write "Your screen Available Width is " & Request.Form("Avail_Width")
 Response.Write "<BR><BR>"
 Response.Write Replace(Request.ServerVariables("ALL_RAW"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write Replace(Request.ServerVariables("QUERY_STRING"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write "Your IP Address is " & Replace(Request.ServerVariables("REMOTE_ADDR"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write "Your Referer is " & Replace(Request.ServerVariables("HTTP_REFERER"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write Replace(Request.QueryString("message"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write Replace(Request.Form("ALL_RAW"),vbcrlf,"<BR>")
 Response.Write "<BR><BR>"
 Response.Write "The Time is " & time & "<BR>"
 Response.Write "The Date is " & date & "<BR>"
 Response.Write "</HTML></BODY>"

For the sake of completeness you can see the file that is kept holding the information submitted Click here

Now there - aint that simple    !!

I do hope that it has been interesting or of benefit to you.