Is there a tool to dynamically change javascript launch in browser?

Is there a tool to dynamically change javascript launch in browser? For example, to change the values โ€‹โ€‹of javascript variables at runtime.

+4
source share
8 answers

Firebug, or Venkman Javascript Debugger.

+4
source

So Firebug really is one of the best options - or if you are the developer who owns Visual Studio and want to debug it using IE, you can do it. Suppose you do this with Firebug using Firefox.

First, determine where you want to change the code and place the following line directly in front of the line with which you want to start messing:

debugger; 

This will cause Firebug to stop the script at that point, after which you can go through the code and change the values โ€‹โ€‹of the variables.

You can also use Firebug to place breakpoints by clicking to the left of the line of code in the Firebug script window:

Firebug Breakpoint Screenshot

+6
source

Take a look at the javascript shell here . It looks like a debugger in your browser. You can run / modify any javascript function in the active document object.

It is very suitable for debugging / processing other javascripts of people on sites where you do not have access to the source / server.

Did I mention that it has tab completion? this is amazing.

+3
source

Opera 9 comes bundled with Dragonfly (the equivalent of FireBug), and I realized that it can also edit JavaScript on the fly. This, at least, is a feature if they did not have time to turn it on. Anyway.

+2
source

Take a look at Firebug

+1
source

As others have mentioned, Firebug allows you to set breakpoints in your JavaScript (although I did not have much success with hitting breakpoints when my JavaScript is in an HTML document and not in an external file), which will interrupt the function at runtime.

It also allows you to view DOM objects and all properties (including your JavaScript variables).

There is also a Lite version of Firebug that will work on browsers other than Firefox.

+1
source

Mozdev has a tool called MozREPL . You can not only change and redefine the code on the fly, but also get access to the base code of the browser. It's really cool.

It opens a port on yoru amnmd allwos so that you connect a telnet session (only from the local host) to it to start code execution. You can also open this port before connections that are not connected to localhost .... (but be careful, this is rather insecure and dangerous, etc. Etc.).

It comes with a small emacs mode that allows you to send various areas of text directly to mozdev and provides a very nice interaction mode. I also expanded it to set Firebug breakpoints directly from emacs and run selenium tests. Basically, I can script my browser from my editor. This is pretty cool. At some point, I will release the source code soon.

0
source

JavaScript has an eval () function, you can create your own string and then run it.

 <script type="text/javascript" language="javascript"> example = function() {alert('first');} example(); eval("example = function() {alert('second');}"); example(); </script> 

The above code is an example of how eval can be used to modify existing code.

@eyelidlessness, this shows that you can modify existing code. Your editing of the question clarifies the original question, but, therefore, my answer looks invalid, but at the time it was originally published, it was correct, the original poster should make the question clearer.

-3
source

All Articles