Javascript Errors
JavaScript is a scripting language developed by Netscape for web browsers and is the de facto standard for scripts on web pages (it is also possible to use VBScript but almost no one does since it is only supported by IE). Microsoft uses an implementation of JavaScript called JScript, and while there are some differences between the two (and implementations in other browsers), everyone refers to browser scripting as JavaScript. Many people think that Sun’s Java programming language and JavaScript are related but the only things they share in common are the name and superficial syntax conventions.
It is important to understand the difference between JavaScript, scripting languages like PHP and ASP, and web programming languages like Java and ASP.NET. JavaScript is a client-side scripting language, and it runs on your browser. Essentially, the web page you visit tells your computer what to do, and your computer does it. Scripting languages like PHP and ASP are server-side scripts that are read through an interpreter on the web server and displayed to your browser. Web programming languages like Java and ASP.NET (Java is not strictly a web programming language but ASP.NET is) are actually programs that run on the server, created ahead of time by the web site designers. Instead of parsing a script which can be changed on the fly, the web server acts as a front-end to another program and any changes to the program require that it be recompiled.
The Fundamental JavaScript Problem
Each browser has its own interpretation of JavaScript and this quickly leads to problems. A few years ago, nearly everyone used Internet Explorer to surf the web. There were still some holdouts from the 90’s Microsoft/Netscape browser war but not many. This lead web developers to code JavaScript that they only checked in Internet Explorer. Even though IE 4.0 kept to published web standards better than Netscape 4.0, Microsoft began developing its own proprietary implementation of JavaScript and other web languages, adding non-standard items and leaving other standard items unimplemented. The result was a lot of pages that only worked in IE.
Apple threw its own implementation into the mix with the Safari web browser in 2003, which muddied the waters a bit as Mac usage began to climb. A year later Firefox burst upon the scene as a faster, safer alternative to IE and gained 10 percent market share by November 2005. Moreover, Firefox closely implemented the standards set forth by the W3C, an independent group that has been publishing web standards since 1994 and whose director, Tim Berners-Lee, invented the World Wide Web in 1989.
With at least three major implementations out there, it is very difficult for web site designers to check that their pages work in all three browsers. When they don’t, JavaScript errors will occur.
Other Causes
Spyware can cause JavaScript errors if it modifies how your browser handles JavaScript code, which many do by capturing keystrokes and mouse-clicks hoping to catch your passwords and pin numbers on banking sites and online stores. Spyware will also try to place its own custom ads on web pages which also can cause JavaScript errors. Getting rid of spyware can be difficult but I have outlined steps to prevent, detect and clean up spyware in my Dealing with Spyware blog entry.
Pop-up blockers can also cause JavaScript errors although this is always the fault of the web site for not checking to see that pop-ups are disabled. If you trust the site you are on, you can disable the pop-up blocker for that site to see if it helps. Another trick is clearing your cache - some websites have multiple JavaScript files and if you don’t have the latest one you could be calling a piece of code that no longer exists.
If you use Firefox, you can cut down on the number of JavaScript errors by installing the NoScript extension. This will allow you to choose which sites run JavaScript and which do not. A lot of sites work fine without JavaScript for casual surfing.