Forum Moderators: open
I have built a visitor logging system. This gets all the stats you would normally get from logs and more. I logs and analyses all you visitors moves. I must say, even though it is my baby I am very impressed (please dont ask for a copy as I am not distributing it). However, there is a question that always crops up on many sites. I have decided to post an answer here in case anyone was struggling with this.
How, using ASP, do I obtain a visitors screen resolution?
This cannot be done using just ASP, however, it is possible. Here is a sample piece of code that uses client side script to pass the resolution to ASP so you can do what ever you want with it.
<%
Dim ScreenWidth
Dim ScreenHeight
If Request.QueryString("ScreenWidth") = " " Then
%>
<SCRIPT lauguage="VBScript">
Dim ScreenWidth
Dim ScreenHeight
ScreenWidth = Screen.Width
ScreenHeight = Screen.Height
document.location.href = "page.asp?ScreenWidth=" & ScreenWidth & "&ScreenHeight=" & ScreenHeight
</SCRIPT>
<%
Else
ScreenWidth = Request.QueryString("ScreenWidth")
ScreenHeight = Request.QueryString("ScreenHeight")
%>
<html>
<head>
</head>
<body>
Your resolution is <%= ScreenWidth %> x <%= ScreenHeight %>.
</body>
</html>
<%
End If
%>
Chris.