![]() |
| Home | Demo | Services | Features | Help | User Forum | Blog | About | |
|
|
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
I think you dont understand what it means to generate DHTML using Javascript and DOM...
|
|
#4
|
||||
|
||||
|
Quote:
__________________
Christina >>Forum Moderator<< Please do not PM me for support. The forum is here for that. |
|
#6
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
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&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
|
||||
|
||||
|
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
|
|||
|
|||
|
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... |
![]() |
| Thread Tools | |
| Display Modes | |
|
|