Firefox 'Error Loading Script' Errors

0 comments
Browser Scripting Errors ...
1. Every serious web author who uses JavaScript scripting on their web pages should read this page, even if they do not use the window.onerror event to trap scripting errors on their pages.
2. This page provides a unique insight into the real cause of 'Error Loading Script' errors in Firefox browsers and exposes the joint villains of the situation, Google and Firefox.
3. This page introduces you to a first class online tool that you can use to error check your JavaScript scripts and library files. This service is completely free of charge.

Firefox browsers in particular, are finicky when it comes to throwing JavaScript scripting errors and this
 peculiar behavior should not be attributed to Firefox meeting standards which other browsers do not meet. Unfortunately, most web authors do not realize the extent to which their web pages can throw scripting errors under different circumstances and many surfers do not realize or properly understand that a web page they are viewing, may not be working properly or as the page author intended.

However, there is one group of web developers who are not working blind and who do understand the extent of this problem, and these are the developers who use the JavaScript 'window.onerror' event to trap and record scripting errors on their web pages. This Web page you are viewing utilizes such a system and if you view the source Markup of the page, you will see near the top of the page, the JavaScript routine that traps details of scripting errors before transmitting this information back to the web server. These scripting error records are appended to a scripting error log file on the server which we then use to repair and try to eliminate scripting errors from all the pages on our Website.

View This Page's Source Markup
A JavaScript error event occurs when the users browser encounters a JavaScript script syntax error or a JavaScript script runtime error. A JavaScript error event does not occur for ordinary browsers errors like for example, 'file not found'.

Understanding The Scale ...
Prior to our introducing error trapping to record scripting errors on our web pages we thought that our JavaScript scripting was mature and error free. After all, we were experienced programmers and had tested all our routines on a number of web browsers running on our Windows 2000 workstations.

At the time we introduced the error trapping system (March, 2006) Web-Wise-Wizard was serving between 1,500 to 2,500 content pages a day to human visitors and you can imagine our annoyance when we discovered that the daily scripting error log files were in excess of 100KB in size. It soon became obvious that our well behaved JavaScript scripts that worked well on a Windows PC running Internet Explorer, could often throw scripting errors when for example, the page was loaded into a Firefox browser running on a different platform. At this point I feel that we should make it clear that we are not picking on one particular browser because all browsers can throw scripting errors from time to time, depending on the environment they are running in and also depending on the quality of the scripting on the web page in question.

It is our intention to provide a seperate tutorial showing you how you can introduce JavaScript error trapping on your own web pages. The tutorial will include various client-side options and for those of you that have a CGI capability on your web sites, we will also provide a working Perl script that will record errors in a script errors log file on your server.

Reducing The Errors ...
These unwelcome revelations brought to light by our scripting error log forced a rethink on how we tested the scripting on our web pages. After all, we used the W3c validators to validate the HTML Markup and the CSS styles on our web pages but we had no way of checking or testing the scripting on our web pages or in our JavaScript library files. The problem lay in the fact that there was no central authority like W3c who could set standards for scripting on a web page or provide facilities to validate scripting on web pages. The situation is made even worse by the fact that we are no longer able to specify which version of JavaScript we were coding to when creating our JavaScript scripts.

this example scripting language declaration is now depreciated...

and is replaced by a declaration that uses a MIME type and does not specify a version...

introducing a top notch JavaScript error checker...

An eventual solution presented itself when we discovered a tool called JavaScript Lint and this tool made a pretty good job of error checking all our JavaScript scripts for common mistakes without actually running the scripts or loading the web pages. This service is completely free of charge (they do not even require you to register or provide an email address) and I recommend that every JavaScript scripter should test their own web pages or library files using this type of service. We provide the following link to their online service which you can try out and use immediately.

Online JavaScript Error Checker
The effect of our error checking the scripts on our web pages and in our JavaScript library files was immediate. Once we started using the error checking service we found errors that we did not know about. The number of scripting errors recorded in our scripting error log fell overnight, by as much as 60%/70%. For this reason we strongly recommend that all web authors error check their JavaScript scripts in this manner, even if they do not incorporate an error trapping system for the scripts on their web pages or in their JavaScript library files.

At Web-Wise-Wizard, we are starting the process of developing an online JavaScript error checking service of our own. It will be based on the JavaScript Lint checker which is open source code but it will have a user interface similar to the W3c validators which many web authors will already be familiar with.

'Error Loading Script' Errors ...
Reducing the number of errors and potential errors in our web page and library scripts had the effect of dramatically reducing the size of our daily scripting error log files. There were still a considerable number of scripting errors each day and with the benefit of hindsight these errors can be split into two categories; those errors that were within our control to fix and those errors that were not within our control to fix.

If we start by discussing those remaining errors that were within our control to fix. Every day we would examine the scripting error log file and having determined the details of each error we would load the offending web page or JavaScript library file into our HTML editor and then correct or rework the scripting to gradually eliminate this category of error. These errors were fairly easy to fix because the error log file provided information about the URL, line number, error description, users browser, etc., and we found that each individual offending page or library file could be the cause of a large number of the remaining errors in the scripting errors log file.

If we then move on to discuss those remaining errors that we eventually found were not within our control to fix. This group of errors can be easily identified by the following information contained in the error record and you can compare this information with the scripting error log file record displayed below (the one with the double black border around it).

1.Firefox/Chrome/Mozilla Browser (and presumably other Gecko based browsers too).
2.All error events are recorded as happening on Line 1.
3.The error message is typically 'Error Loading Script'.
4.File not loaded is a legitimate JavaScript library file.
I was bugged by these errors and spent a lot of time on my own Website trying to find the cause of the problem. I could not even recreate the error so I started haunting the blogs to find an answer. I came across many guesses and suggestions as to the cause of the problem and with the benefit of hindsight the only suggestion that I would give any sort of credence to is to make sure that all the JavaScript scripting is error free. At a minimum, this means that you must error check and correct the scripting on your web pages and JavaScript library files.

The Amazing Error Log Entry ...
Then in late November, 2008 came the breakthrough I had been hoping for. Late one night I was examining a daily scripting errors log file and came across the following entry for a Google, New Zealand Webpage. I loaded the URL into a browser and noted that the fourth search result down the page pointed to a page on the Web-Wise-Wizard site.

try the Google link to see if the Web-Wise-Wizard result is still there...

165.84.106.xxx
01:06:15
Line 1
clk is not defined
http://www.google.co.nz/search?hl=en&q=javascript%20simple%20email%20validation%20strict&start=20&sa=N
Firefox
5.0 (Windows; en-US)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7Now I did say it was late at night and I think that I must have been feeling a bit docile at the time I first saw this record. However, when I awoke the next morning I ready to start kicking myself around the bedroom.

Why on earth was a scripting error for a Google, New Zealand Web page being recorded in the Web-Wise-Wizard scripting error log?

Immediately following the Google error record was another error record, this time displaying the more familiar 'Error Loading Script' error and this record was legitimate for the Web-Wise-Wizard site. Both records were from the same IP address and had an identical time stamp and if you are wondering how this could happen it is because the Web-Wise-Wizard error trapping routine is designed to handle multiple errors, one immediately after the other in an split second.

It is also worth noting that I checked if the 'clk is not defined' error could be legitimate for the Google search page and found that they did use (or misuse) the variable 'clk'. I then tested the Google search page source Markup in the JavaScript error checker and found a variety of warnings and errors, not including the 'clk is not defined' error.

165.84.106.xxx
01:06:15
Line 1
Error loading script
http://www.web-wise-wizard.com/js/script-bin.js
Firefox
5.0 (Windows; en-US)
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7

Comments

0 comments to "Firefox 'Error Loading Script' Errors"

Post a Comment

Feel free to comment

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com