Search code examples
javascriptdebuggingfirefoxfirebug

How to make firefox report the javascript error?


I am developing with Firefox and Firebug, but in my environment if the js has the syntax error, the firefox will not report any error, it just stops there.

Then I have to use IE to reload the page, IE will report the error at the bottom left corner, and after clicking it I can see the line number of the js error.

I am wondering if I misconfigured something? I think at least firebug should report the error as IE does. But firebug displayed nothing.

The example code(show error in IE but normal in FF):

<!DOCTYPE html>
<html>
<head>
  <style>
  body { color:blue; }
  </style>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
<script>
    if (a < ) 0 {
    }

</script>

</body>
</html>

Solution

  • To configure Firebug to show errors, do the following:

    • Click the arrow on the Console tab.
    • Make sure it's Enabled.
    • Make sure "Show JavaScript Errors" is checked.

    You should see the errors in the console now, and it should show you the line number and filename.

    I am using Firefox 3.6 and Firebug 1.5.0.

    UPDATE: This same process also works in the latest Firefox Nightly 19.0a1, using Firebug 1.10.4. Thus, these instructions are still up to date.