7.7. Testing JavaScript

With layout issues, each browser also renders JavaScript differently. The same JavaScript can work perfectly in one browser while being completely broken in another. We have already described the different approaches you can take to test a site on multiple browsers, but as you are testing the site you should also keep in mind that JavaScript also behaves differently on each of those browsers. As such, you should be aware of how JavaScript is used on the site, and how it might work differently on the different browsers.

To help test JavaScript there are a number of different browser plug-ins which allow you to debug and profile scripts as they are executing. Each browser has their own set of tools, for example Firefox has FireBug (https://addons.mozilla.org/en-US/firefox/addon/1843), while IE8 and Safari both have built-in tools. These tools are always handy to have installed as they can help identify why the scripts are failing and help you pinpoint the problem.

These tools also have the ability to disable JavaScript and CSS. Disabling JavaScript is not as common as it used to be, however you may find certain people have disabled it for security reasons and due to accessibility issues. By using these browser tools you can see how the site would function with various parts of the site disabled.

Luckily, the issue of cross-browser testing and JavaScript is not the major problem it used to be thanks to jQuery (http://jquery.com/). jQuery abstracts away from ...

Get Testing ASP.NET Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.