Counter related

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
kitsch
Forum Newbie
Posts: 12
Joined: Mon Nov 11, 2002 3:29 pm

Counter related

Post by kitsch »

I wrote my own nice counter in PHP and I have this JavaScript:

Code: Select all

<script language="JavaScript">
<!--
	pmv_vis = 21353245;
	sw = "-";
	sc = "-";
	c = "-";
	je = 0;
	js = 1;
	app = "-";
	app = escape(navigator.appName);
	sw = screen.width;
	sh = screen.height;
	if(navigator.javaEnabled()) &#123;je = 1&#125;
	if(app != "Netscape") &#123;c=screen.colorDepth&#125;
	else &#123;c = screen.pixelDepth&#125;
	r = "pmv_vis="+pmv_vis+"&screenw="+sw+"&screenh="+sh+"&colors="+c+"&java="+je+"&js="+js;
	url = "http://localhost/counter/counter_image.php?" + r; 
	document.write('<img src="'+url+'" width=10 height=10 border=0 alt="counter">\n');
// -->
</script>
This should place a call to my script: counter_image.php which will pass an image but not before recording the user's screen width / heigth, color depth, color depth and whether my visitor has or not Java and JavaScript enabled.

It all works fine on my own computer and with recent browsers. But as soon as I placed this on a site I observed that this system doesn't counts the aforementioned values for 4.x browsers (the browser version is recorded by PHP). Is there a method to make it work?
Post Reply