How can I use Firebug debugger for debugging local scripts?

0

fWhen I'm trying to get my head around a particular javascript issue, I usually create a hello world type application on my local file system and view the HTML with my browser.

The problem I have is that because the resources aren't fetched via the network, firebug won't let me see the scripts, and thus won't let me add breakpoints etc.

How can I make it do this?

user1068446

Posted 2015-12-15T23:15:37.547

Reputation: 1 142

Answers

2

You don't necessarily need Firebug to accomplish this. The built in tools with Firefox are really good now and come with a javascript debugger.

After you page loads, right click anywhere and select Inspect Element. This will bring up the Firefox Inspector Tools.

For javascript click on to the Console tab and then reload your page and it should show any errors that come from javascript. You cah also type into this console to test javascript on your page.

On the Debugger tab it will show all the javascript that has loaded for your page and you can add breakpoints in here and then reload your page to test them.

tyelford

Posted 2015-12-15T23:15:37.547

Reputation: 442

... I'm using Firefox 11... – user1068446 – 2015-12-16T00:11:48.510

Firefox 11 is outdated for years. The current stable version is 42. So you should update your Firefox installation first. – Sebastian Zartner – 2015-12-16T06:37:23.020

Correction, since yesterday the stable version is 43.

– Sebastian Zartner – 2015-12-16T06:44:12.503

@SebastianZartner That's not useful advice for the context of my work environment :) – user1068446 – 2015-12-16T10:26:40.373

1Well, your problem could be related to that old, unmaintained versions of Firefox and Firebug you are using. Everybody should try to stay up-to-date with their software and install updates and security fixes. If it's not up to you to do so, e.g. due to some company restrictions, then you should at least contact your administrator to take care of updates. – Sebastian Zartner – 2015-12-16T20:44:53.937

I agree with @SebastianZartner you should be able to get your hands on the latest (or at least a later) version of Firefox. Firefox 11 was released almost 4 years ago, March 13, 2012. The amount of bugs and security fixes since then would be astronomical.

– tyelford – 2015-12-16T22:12:23.190

0

It is irrelevant if the script is local or remote, it should always be shown within the Script Location Menu.

The important point to note is that it is not shown there if it contains any syntax errors. To check whether there are any syntax errors within your script, switch to the Console panel, ensure you have the option Show JavaScript Errors enabled and have a look for red lines.

Sebastian Zartner

Posted 2015-12-15T23:15:37.547

Reputation: 697