how to reload only scripts through firebug
I’m doing lot of ajax stuff lately. Scenario that I repeat over and over is:
- load page
- change some scripts for that page
- reload page with ctrl+f5 and see if it works
What I want to do, is tell firebug to reload only the scripts not the whole page because the markup is the same. Anyway to do this?
4 Solutions collect form web for “how to reload only scripts through firebug”
First, try and minimize this kind of testing. Write atomic, DRY code, and unit test before folding it into the site/page. You can do some of this quickly in Firebug’s console.
Next, if the JS that you are reloading sets intervals or event listeners, then you will want to clear those intervals and unbind those listeners before reloading the JS under test. That means that anonymous intervals and event handlers are verboten.
Create a JS file that calls
.unbind() as necessary.
Then you can run code like this in Firebug’s console:
I think XRefresh may help. It monitors your local folders for changes and reloads them when they change (after you save) without reloading the entire page.
Per their site faq:
XRefresh is also able to replace externally linked JS file with
updated version without reloading whole page.
There are limitations with this though (and I don’t see any way of getting around them) which you can read more about on their faq page.
I still think its better than having no option at all.
Hope this helps.
I think what you really need is automated testing. Write your tests and then just rerun them after making a code change.
The best method for doing this on firefox is webdriver.
Firefox currently has no way of doing this.
If the markup is the same then what’s wrong with ctrl+f5? I’m guessing you don’t want to loose the data in the form fields? This again causes problems as what happens if you just reload the scripts and those scripts have events that fire when form fields are changed, these events will never firing and could result in the page ending up in a state it shouldn’t be in.
There are some browser plugins that allow you to automatically fill in form fields at the click of a button with pre defined values, this may be a good alternative to reloading just the scripts. It looks like this firefox plugin will do just that https://addons.mozilla.org/en-US/firefox/addon/autofill-forms/