I have a javascript error that is driving me nuts. I maintain a web site that has up to 1500 vists a day. Less than a handful of users have reported a failure of javascript elements in the pages. A few of those users have been helpful in giving me some specifics re the errors they are receiving. This is what I have found:
1. My javascript is valid – using syntax checker such as lint detects no errors.2. It works for large majority of users – maybe 99% or more, on a variety of browsers, versions and O/S. I can’t recreate the problem (checked on W2k, XP, Linux, Mac, IE6, IE7, Opera, Konqueror, Ffox1.5, Ffox2 etc.)3. For those that have errors, some of the javascript works, some doesn’t (this rules out the disabling of javascript in the browser)4. The only common attribute of the users with errors are latest browsers (IE7, Ffox2) on XP. This should be a clue, but still can’t work it out. I have the same set-up available, but all is OK for me.5. I created sample pages for the users to test. I put an error alert in the header, which throws up “Object Expected” errors for them. That of course is javascript, and it proves that javascript does work for them (sometimes)!6. What fails to work in all situations for these specific users is when I put the a <script> entry in the header pointing to source elsewhere:
eg: <script type=”text/javascript” src=”jscript/xxxxx.js”></script>
then in the body of the html I have:
<script type=”text/javascript”>
<!–
bldHdg()
// –>
</script>
(BTW, I have included/excluded language=”javascript” for no effect)
7. In my samples I have inconsistent success with the following approach in the HTML:
<script type=”text/javascript” src=”jscript/yyyyy.js”></script>
8. Also in my samples I have inconsistent success with the following approach in the HTML:
<script type=”text/javascript”>
var graphic2 = ‘images/conf_2008w/logo_120.jpg’;
document.writeln(‘<img src=”‘ + graphic2 + ‘” alt=”filler” /> n’);
</script>
I stress that it may only be 1% or even less (based on feed-back). My thoughts are something environmental on the users PCs. My understanding of the “Object Expected” error is that it can’t find something it needs. Why does such a small minority not find the source, or execute selected javascript items?
If I could recreate the problem, I reckon I could solve it. But relying on a non-technical remote third-party for feed-back is not productive.
Any feed-back / suggestions appreciated.
All my analysis tells me