test.htm ======== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled</title> <script language="JavaScript"> function GetWHC(){ //alert(screen.colorDepth); //alert(screen.availWidth); //alert(screen.availHeight); myURL = "insert.cfm?width=" + screen.availWidth + "&height=" + screen.availHeight + "&colordepth=" + screen.colorDepth; //alert(myURL); newwin=window.open(myURL,"newwin","width=0,height=0"); newwin.close() } </script> </head> <body onload="GetWHC()"> </body> </html>
insert.cfm ========== <cfparam name="visitors" default=""> <cfif fileexists("#GetDirectoryFromPath(GetBaseTemplatePath())#visitors.txt")> <cffile action="READ" file="#GetDirectoryFromPath(GetBaseTemplatePath())#visitors.txt" variable="visitors"> </cfif> <cfset visitors = visitors & "#url.width#|#url.height#|#url.colordepth##chr(13)##chr(10)#"> <cffile action="WRITE" file="#GetDirectoryFromPath(GetBaseTemplatePath())#visitors.txt" output="#visitors#" addnewline="No"> Anthony Petruzzi Webmaster 954-321-4703 http://www.sheriff.org -----Original Message----- From: Jason Larson [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 4:17 PM To: CF-Talk Subject: RE: Screen width, Height, & Color Depth I need to obtain this info when someone enters the site. Thanks, Jason Larson -----Original Message----- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 2:06 PM To: CF-Talk Subject: RE: Screen width, Height, & Color Depth opps forget the first half: can you use: <script> document.write('<input Type="Hidden" Name="screen_height" Value="'+ screen.height +'">'); document.write('<input Type="Hidden" Name="screen_width" Value="'+ screen.width +'">'); document.write('<input Type="Hidden" Name="screen_colors" Value="'+ screen.colorDepth +' Bit">'); </script> #screen_height# #screen_width# #screen_colors# -----Original Message----- From: Sam Roach [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 12:58 PM To: CF-Talk Subject: RE: Screen width, Height, & Color Depth can you use: #screen_height# #screen_width# #screen_colors# -----Original Message----- From: BEN MORRIS [mailto:[EMAIL PROTECTED]] Sent: Monday, March 25, 2002 12:49 PM To: CF-Talk Subject: Re: Screen width, Height, & Color Depth You will have to have one form page that they come to and have JS write the values in a hidden form field, then have that submit to an action page, after which you will have the values to use in CF. Of course, you can't capture this in all browsers. More JS help: http://www.webreference.com/js/column17/dimensions.html >>> "Jason Larson" <[EMAIL PROTECTED]> 03/25/02 03:35PM >>> I have very little javascript experience and what I am trying to accomplish is to use javascript to give me the height, width and color depth of a user's browser and turn those javascript variables into a CF variable so I can use them in a cf template. I was wondering if anybody had any code snippets for something like this, and if so would you mine sharing. Thanks in advance, Jason Larson ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists