StatCounter User Forum  
StatCounter Free web tracker and counter

Go Back   StatCounter User Forum > StatCounter.com > Bugs

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 02-01-2005, 06:52 AM
TriMoon
Guest
 
Posts: n/a
Default Script bugging DHTML using DOM

When i let my application create the script code inside a DOM ovject it cuases my whole page to clear out.
How can i still get the functionality without this buggy behaviour?
PS: its not my code thats causing the bug, its the commands inside your script!

See my homepage for the DHTML application where i want to use it.
  #2  
Old 02-01-2005, 06:58 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,172
Default

You may need to generate the version of the code for xhtml and make sure you don't break it across lines when you insert it.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
  #3  
Old 02-01-2005, 03:27 PM
TriMoon
Guest
 
Posts: n/a
Default

I think you dont understand what it means to generate DHTML using Javascript and DOM...
  #4  
Old 02-01-2005, 04:47 PM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,172
Default

Quote:
Originally Posted by TriMoon
I think you dont understand what it means to generate DHTML using Javascript and DOM...
I definitely don't know what you DOM thing is
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
  #5  
Old 02-02-2005, 03:34 AM
TriMoon
Guest
 
Posts: n/a
Default

In that case have a read about it here at W3C-DOM
FYI, My application uses DOM2, with backsteps to DOM1 for browsers who are not compatible with DOM2 like IE...


PS: Why no one from statcounter replies to my bug?
  #6  
Old 02-03-2005, 11:09 PM
TriMoon
Guest
 
Posts: n/a
Default FYI

FYI this is the code i used to generate the code using DOM in JavaScript:
Code:
		// Create an script element. (var init)
		DomObj[0] = document.createElement("script");
		DomObj[0].setAttribute("type", "text/javascript");
			DomObj[1] = document.createTextNode("<!--");
		DomObj[0].appendChild( DomObj[1] );
			DomObj[1] = document.createTextNode("var sc_project=541068;");
		DomObj[0].appendChild( DomObj[1] );
			DomObj[1] = document.createTextNode("var sc_partition=3;");
		DomObj[0].appendChild( DomObj[1] );
			DomObj[1] = document.createTextNode("//-->");
		DomObj[0].appendChild( DomObj[1] );
oTD.appendChild( DomObj[0] );
		// Create an script element. (counter script)
		DomObj[0] = document.createElement("script");
		DomObj[0].setAttribute("type", "text/javascript");
//		DomObj[0].setAttribute("src", "http://www.statcounter.com/counter/frames.js");
		DomObj[0].setAttribute("src", "http://www.statcounter.com/counter/counter_xhtml.js");
oTD.appendChild( DomObj[0] );
  #7  
Old 02-04-2005, 01:16 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,172
Default

Do YOU know what you're missing or what is wrong? If you posted a link to a page which suffers from some bug you think you found in the Statcounter code, please post it. It's impossible to evaluate otherwise.

Have you looked at the code that is generated by this on your page to see in which way it interferes with your other stuff?

The Statcounter code works fine in regularly rendered html pages where you insert the appropriate version just as it is. Whatever programming language you may use has got to generate html code that is exactly as the one to be inserted otherwise.

You have to take into account yourself the limitations and the restrictions of construct of your application.

I have yet to find an actual bug that could be attributed to the Statcounter code, always usage error, and I'm referring to the last several months of using it. You may debate the stats on the reporting side, but not the code itself that serves simply to log information.

Why no staff answers your bug? If you feel it's a real bug, you should open a support ticket. Otherwise you post it in the forum like you did and let others discuss and try to help if they can.

Obviously I cannot help you.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
  #8  
Old 02-04-2005, 02:13 AM
TriMoon
Guest
 
Posts: n/a
Default

The bug is in the Statcounter script 100%.
Why?
Because it uses "document.write()" to insert code into your page.
This is normaly ok when using regular HTML/XHTML but not when the contents of the page is generated using the DOM interface.
So what ppl like me need is a DOM version of the script.

For now i have dug into the script that gets loaded and incorporated the actual used code into my DOM-Application.

I simply could not wait for others to help as obviously DOM is to new a technology for this project,
i even asked for parameters and no one replied to it.

for those that are interested here is the actual code i incorporated into my application.
People who are familiar with DOM will know to adjust it to their needs.
Note: I generate the current page location each time it gets used as the application shows a different info page when the image is to be shown (footer)

Good luck all and bb4now
Code:
						// Create an anchor element.
						DomObj[0] = document.createElement("a");
						DomObj[0].setAttribute("href", "http://my.statcounter.com/project/standard/stats.php?project_id=541068&guest=1");
							var sCurLoc, tmpImg = new Image();
							sCurLoc = document.location.protocol + "//" + document.location.host;
							sCurLoc += document.location.pathname.substring(0, 1+document.location.pathname.lastIndexOf('/'));
							sCurLoc += Universe.Control.MakeSearch();
							sText = "http://c4.statcounter.com/t.php?";
							sText += "sc_project=" + 541068;
							sText += "&resolution=" + screen.width;
							sText += "&camefrom=" + escape(document.referrer.substring(0, 150));
							sText += "&u=" + escape(sCurLoc);
							sText += "&t=" + escape(document.title.substring(0, 150));
							sText += "&java=1";
							sText += "&sc_random=" + Math.random();
//							sText = "http://c4.statcounter.com/counter.php?sc_project=541068&amp;java=0"
							tmpImg.src = sText;
							// Create an img element.
							DomObj[1] = document.createElement("img");
							DomObj[1].setAttribute("src", sText);
							DomObj[1].setAttribute("alt", "StatCounter - Click for stats");
							DomObj[1].setAttribute("title", "StatCounter - Click for stats");
							if(isIE4||isIE5||isIE6){
								DomObj[1].width = 58;
								DomObj[1].height = 17;
							};
						DomObj[0].appendChild( DomObj[1] );
					oTD.appendChild( DomObj[0] );
  #9  
Old 02-04-2005, 02:56 AM
webado's Avatar
webado webado is offline
Moderator
 
Join Date: Apr 2004
Location: Montreal, Quebec, Canada
Posts: 28,172
Default

You are aware that by using this code you may be breaking the TOS of Statcounter, are you not?

If anything in the javascript code scurrently stored on the Statcounter servers gets modified you will not have those modifications reflected in your code either.

The code works as javascript and/or html. If DOM cannot handle either of those situations, then the code is not for you and this application.
__________________
Christina
>>Forum Moderator<<

Please do not PM me for support. The forum is here for that.
  #10  
Old 02-04-2005, 04:15 AM
TriMoon
Guest
 
Posts: n/a
Default

1st of all I am not breaking any of the Statcounter T.O.S. as i am not modifing the code in their scripts.
2nd why you think i posted a bug report asking for a DOM version?

If they disable my counter because i am using this code while they dont provide a DOM version then so be it and i will just move on to a different counter.
Afterall this is not the only one on the web...
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:04 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.