Place sopmething like this in the <HEAD> (the submit stuff is what matters !)
function myinit() {
 if(location.pathname.indexOf("done")==-1) {
  alert('Thanks for calling')
  document.myform.submit()
 }
 return
}

Invoke it when the body is loaded as
<BODY OnLoad=myinit()>


Get the browser properties into global variables with the following code
 var n=navigator.appName
 var c=navigator.appCodeName
 var v=navigator.appVersion
 var u=navigator.userAgent
 var j=navigator.javaEnabled()
 var p=navigator.platform
 var s= typeof screen
 if (s != "undefined" ) {
    var h=screen.height
    var w=screen.width
 }
 // for netscapish
 //if (parseInt(navigator.appVersion)>3) {
 //if (navigator.appName=="Netscape"||navigator.appName=="Konqueror") {
 if (navigator.appName.indexOf("Microsoft")==-1) {
    var h1=self.innerHeight
    var w1=self.innerWidth
 }
 // for microsoft
 if (navigator.appName.indexOf("Microsoft")!=-1) {
    var h1=document.body.offsetHeight
    var w1=document.body.offsetWidth
  }
 //}
 

Define a function which returns the various items in the format of text areas in an HTML form
 function vedi(cosa) {
  if (cosa=="name") document.write("<INPUT type=text size=50 name="+cosa+" value='"+n+"' >")
  if (cosa=="code") document.write("<INPUT type=text size=50 name="+cosa+" value='"+c+"' >")
  if (cosa=="vers") document.write("<INPUT type=text size=50 name="+cosa+" value='"+v+"' >")
  if (cosa=="agen") document.write("<INPUT type=text size=50 name="+cosa+" value='"+u+"' >")
  if (cosa=="java") document.write("<INPUT type=text size=50 name="+cosa+" value='"+j+"' >")
  if (cosa=="plat") document.write("<INPUT type=text size=50 name="+cosa+" value='"+p+"' >")
  if (cosa=="scre") document.write("<INPUT type=text size=50 name="+cosa+" value='"+w+"x"+h+"' >")
  if (cosa=="wind") document.write("<INPUT type=text size=50 name="+cosa+" value='"+w1+"x"+h1+"' >")
  return
 }

Define a form which calls a dispatcher CGI (source not shown)
The dispatcher is automagically submitted when the page is loaded, requiring no intervention by the user. Hence the form has no submit button, but is submitted by init
The dispatcher will store the results into a file (append them) and return a Location (redirect) to a page called done.html which is a soft link to this same page. Only when the page is loaded under this second incarnation, the OnLoad does not do anything.
<FORM method=GET action="dispatcher.cgi" name=myform>
<table border>
 <tr><td>IPAddress</td>
     <td><INPUT type="text" size=50 name="ipaddr" value=
     <!--#echo var="REMOTE_ADDR"-->></td>
 </tr>
 <tr><td>Hostname</td>
     <td><INPUT type="text" size=50 name="host" value=
     <!--#echo var="REMOTE_HOST"-->></td>
 </tr>
 <tr><td>Browser</td>
     <td><script>vedi("name")</script></td>
 </tr>
 <tr><td>Codename</td>
     <td><script>vedi("code")</script></td>
 </tr>
 <tr><td>Version</td>
     <td><script>vedi("vers")</script></td>
 </tr>
 <tr><td>User Agent</td>
     <td><script>vedi("agen")</script></td>
 </tr>
 <tr><td>Java</td>
     <td><script>vedi("java")</script></td>
 </tr>
 <tr><td>Platform</td>
     <td><script>vedi("plat")</script></td>
 </tr>
 <tr><td>Screen</td>
     <td><script>vedi("scre")</script></td>
 </tr>
 <tr><td>Window</td>
     <td><script>vedi("wind")</script></td>
 </tr>
</table>
<!-- <INPUT TYPE="submit" VALUE="Proceed"> -->
<!-- terminator placeholder to ensure CGI reads last character of previous item -->
<INPUT type="hidden" size=1 name="dummy" value="">

</form>

Just for sake of clarity, the second incarnation displays a message
 if(location.pathname.indexOf("done")!=-1) document.write("Browser info has been recorded")

sax.iasf-milano.inaf.it/~lucio/INAF/Browser-survey/jscode.html :: original creation 2005 mar 10 17:37:17 CET :: last edit 2005 Mar 10 17:37:17 CET