
![]() |
Bompa
JS moron here.
I want to put this on my homepage: <script type="text/ javascript" src="perlcounter.cgi"></script>so I did. ![]() But I want to send additional info in the query string, like the http_referer, but I cant see how to do that. So, I want to have something like this: <script type="text/ javascript" src="perlcounter.cgi?referer"></script>I tried putting just document.referer there? doh <script type="text/ javascript" src="perlcounter.cgi?document.referrer"></script>But that just sent document.referrer LOL HEEEEELLLLLPPPP Bompa JasonD
Perk will moan at me as I am not doing it in an OO dynamic script tag way
<script> document.write ('<scri'+ipt src = "http://www.domain.dom/cgi-bin/script.pl?'+document.referer+'&othervariable='+other.variable+'"></scr'+ipt>'); </script> perkiset
Actually JD, best tool for the job and all... yours is tight and clean. Here it is in a DOM kind of way:
<script> newNode = document.createElement('script'); scriptCall = ' perlcounter.cgi?dr=' + document.referrer;if ((document.all) && (document.getElementById)) { // IE newNode.src = scriptCall; } else { // Everyone else newNode.setAttribute('src', scriptCall); } var target = document.getElementsByTagName('body'); target[0].appendChild(newNode); </script> Cool Bomps! Getting a little more client side action eh? Look forward to helping you with that... /p Bompa
thanks
Bompa
quote author=JasonD link=topic=522.msg3388#msg3388 date=1190646058 Perk will moan at me as I am not doing it in an OO dynamic script tag way <script> document.write ('<scri'+ipt src = "http://www.domain.dom/cgi-bin/script.pl?'+document.referer+'&othervariable='+other.variable+'"></scr'+ipt>'); </script> Hey Jason, I tried yours first cuz it's the simplest for me to learnfrom, but it didn't work. I amwondering about all those single quotes. Like <scri will print literally, but then + ipt src = with no quotes, huh? If it's not insided quotes it's taken as a variable I thought. Anyways, I get the concept of what you are doing and I'm currently fiddling with it. ![]() Bompa JasonD
Bomps.
I fished up the syntax and missed a couple of quotes here n there ![]() quote <script> document.write ('<scri'+'ipt src = "http://www.domain.dom/cgi-bin/script.pl?'+document.referer+'&othervariable='+other.variable+'"></scr'+'ipt>'); </script> jairez
I've looked at this thread a couple of times now, mostly to see how Perk did his OO magic, when I finally noticed JD separated the <><script>> tag.
q: what does that do or prevent from happening? Curious & thanx. /ja perkiset
Lotsa folks will watch for the word "script" on a parameter and kill it.
Separating it makes it more difficult for regexes and such to see the word in an inbound parameter.vsloathe
Yeah obfuscating your script tags is the first step towards social
network trickery![]() jairez
Aaahhh .... that's totally cool! I never thought of that --- I feel like such a Dorothy <>(sans Toto)> when it comes to this stuff.
q: are there other tags I should be aware of? DULSM-GMLO. /ja Dragonlaird
quote author=perkiset link=topic=522.msg3576#msg3576 date=1191960498 Lotsa folks will watch for the word "script" on a parameter and kill it. In addition, many code editors (and browsers) see the script tag embedded in quotes and don't realise it's meant to be a string, they try executing the code within the tag and die horribly (since it isn't complete and wouldn't make sense to a browser at this stage). Similarly, you should always separate the end tag in a similar way to stop the browser from closing your real script tag prematurely. |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads