0

I am playing around with a JavaScript code in Firebug and I would like changes to take effect in that page. Especially when there is code inside jQuery's $.ready() function.

Some kind of refreshing the page without losing of what has been edited. Is there any way to do that?

4
  • Can you be specific or give an example what you want to do? Commented Dec 6, 2014 at 4:32
  • I am playing around with some well done webpages and I am trying to change Javascript code in firebug to see how it will affect the page look. Basically I am learning the script's behaviour that way. Commented Dec 6, 2014 at 20:54
  • Then chrome is the best browser for you. Press F12 and click on Console tab. Here you can direct paste any javascript. Commented Dec 7, 2014 at 4:16
  • I think you can do that even in the IE, Firefox and maybe others. But I wanted to do that more cleanly - in the code. Commented Dec 8, 2014 at 6:38

3 Answers 3

2

Page changes made via Firebug or via Javascript do not persist from one page load to another. Each time a page is loaded, the original HTML, CSS and JavaScript is parsed and loaded (from cache or from the server). Any prior changes will not be there.

The only way for a dynamic page change to be still present after a refresh is for you to save the changed state to a persistent location and then rebuilt the appropriate page content from that state each time the page is loaded.

But, if you make a change to the page and store some state in a cookie, in local storage or on your server, then you can have JavaScript that runs each time the page loads that gets that state from wherever you stored it and then applies the appropriate change to the page. If you're saving the state on the server (on behalf of this particular user), then you could even have the serve modify the page contents before it is served to the browser.

Sign up to request clarification or add additional context in comments.

Comments

1

You can type JavaScript code in the Firebug command line and see changes take effect on the page. You can do the same in the Firefox, Chrome, Opera and Safari DevTools.

Firebug console

2 Comments

thanks. I never tried to proceed longer scripts in the console until now.
Though note that the code executed there won't persist on reload, either.
1

Changes to pages done via Firebug do not persist. After a page reload the original sources will be loaded again (from the server or the browser cache).

Currently Firebug doesn't allow you to edit the code of the loaded scripts directly.

Though you can execute JavaScript code within the context of the page by using the Command Line: Command Line in Firebug

Or for longer scripts you can use the Command Editor: Command Editor in Firebug

But again, code you executed there will be gone as soon as the page is reloaded.

To make permanent changes to the JavaScript code of a page you need to have access to the server and make them there.

1 Comment

I know that after reload the changes are gone. I was asking for some kind of "just firebug reolad" or whatever would do the thing. but thanks anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.