Javascript not working in Internet Explorer

I know nothing about Javascript. But I have just designed an XHTML/CSS website and am using an online stat counter that uses Javascript. I have pasted the code into the footer section of my homepage and it works just fine in Firefox. But I cannot view the stat counter in Internet Explorer.

I have another Javascript script running a slideshow. It works fine in both browsers. Could this be the issue though?

I’d post my URL or code but it seems I can’t do that on this forum unless I have 5 posts first.

Please help!:slight_smile:

Perhaps it has something to do with the Privacy/Security settings on Internet Explorer? It’s hard to help without knowing what statcounter you are using or what code.

Also: What version of IE?

I’m using stat counter

I can’t paste code or links because this forum won’t allow me to as a new user.

You can view my profile to see what my website is though and find my source code.

It didn’t work in IE7 or IE8

you could past the code at least. Some javascript codes are browser specific and different syntaxed code needed for different browser compatibility.


Here’s my script code. My site is XHTML 1.0 Strict / CSS.

<!-- Start of StatCounter Code –>
<div class=counter>
<script type=“text/javascript”>
var sc_project=5674124;
var sc_invisible=0;
var sc_partition=63;
var sc_click_stat=1;
var sc_security=“04c8cd4e”;
<script type=“text/javascript”
class=“statcounter”><a title=“myspace counters” class=“statcounter”
href=“”><img class=“statcounter”
src=“” alt=“myspace counters”
<!-- End of StatCounter Code –>

I’m not sure what the problem could be. I can view the statcounter in Firefox 3.6, Google Chrome, and IE 6.x. If it works in IE 6.x I would assume that it would work in IE 7/8.

Hi historicolympia, welcome to the forums,

One of the first things I do to help ensure things will be OK cross-browser is check validity. Not that validity errors are the source of the problem in your case, but it can’t hurt to fix them.

Try putting quotes around the attribute values, but more importantly track down and fix the tag mismatch.

I’ve fixed the Validation errors. Now it’s working in IE 6.0. But not IE 7.0 or 8.0. Works fine in Firefox. Any ideas?

What error message does IE 7 and IE8 show you?

You may find it useful to go to Internet Options -> Advanced and turn on the Browsing setting called “Display a notification on every script error”

I don’t have IE7 or IE8 to test with. And the code is minified so it’s not easy to read. But it uses document.write to add script tags. I’m guessing those versions of IE don’t allow that. Have you checked your browser’s security settings? Normally Firefox wouldn’t allow document.write for XHTML pages, but as it’s being served as (invalid) HTML I guess it allows it.


The browser settings are something to check. But as far as I can tell the page has a noscript fallback that uses a replacement image for non-js browsers.

Speaking of abbreviations, Sometimes I get too lazy to write out “javascript” all the time, so I use “js” instead. IMHO it’s better than using “java” because although we know it’s not the same thing it might confuse newbies.

From a Java forum sticky

check whether java enabled on your internet explorer