views:

183

answers:

4

I use the following to implant a script into random websites: (added by webmasters just before /body )

<script type="text/javascript">
var xHost = (("https:" == document.location.protocol) ? "https://" : "http://");
document.write(unescape("%3Cscript src='" + xHost + "domain/script.js.php?u="+encodeURIComponent(window.location.host)+"' type='text/javascript'%3E%3C/script%3E"));
</script>

It is an extension of the way google analytics works. I have it installed on a specific website in which the html above it is not perfectly formed.

It works great on all browsers besides IE6. On IE6 the script never runs. Unless I run fiddler2 in which case it runs perfectly.

Question: How can I make it run on IE6. Any idea why it behaves well when fiddler is in the way and not so well when fiddler isn't?

Notes: I have no control over the web sites that have already integrated this code. When I copied the website page code to my server and run it from there it did run OK.

+1  A: 

Have you tried putting the script tag in the end of the document just before the finishing body element? Usually that's were you put the Google Analytics-code.

Zooking
yes. thats where it is
Nir
+1  A: 

How do you know its not running? Does sticking a simple

alert('hello!');

in the script tag run?

what about above/below the other js code?

Whats "invalid" about the html on the page with problems?

Andrew Bullock
I have no control over the script above. it is already attached at a customer site. I don't want to get the customer involved
Nir
+2  A: 

Ah, I see you're using https here. When fiddler gets in the middle of your code when running https, fiddler uses its OWN certificate to talk to your browser. Maybe your copy of IE6 trusts Fiddler's certificate, but for some reason does not trust the certificate of the site you're referencing?

Dave Markle
+1  A: 

It turns out an add on named activationmanager.dll was causing the problem. Its a spyware. (IE6 is on my 5.5 years old boy computer). Thanks for the help!

Nir
select your answer as the accepted answer
Ovesh
SO makes me wait 48 hours before selecting my own answer.
Nir