ixx
ixx

Reputation: 32273

Live JavaScript edit in Safari?

In Chrome this is possible, but I don't find a way to do it in Safari.
Is it possible? How?

Upvotes: 22

Views: 38584

Answers (5)

Mau
Mau

Reputation: 1313

Try in Safari Technology Preview 15.4:

console.log("I'm live!");

It outputs

> "I'm live!"

Upvotes: -1

Nate Bundy
Nate Bundy

Reputation: 553

As of April 2020, this is now possible in Safari!

https://webkit.org/web-inspector/local-overrides/

Upvotes: 8

Mark Rhodes
Mark Rhodes

Reputation: 10217

The closest option is to pause JavaScript and execute commands from the console.

To open Safari dev tools, press CtrlAltC on Windows or commandoptionC Mac. Or enable Safari dev commands in the menubar in Safari Preferences -> Advanced -> Show Develop Menu.

See Apple's docs on how to use its dev tools.

Unlike in Chrome, the Safari debugger does not currently support the ability to click on a script file and edit it in place. However, you can still stop execution using break points or the pause button, then execute code in the console to alter values, then resume execution.

For example, if you have the code:

var t = 1;
(function(){
    var t = 2;
    console.log(t);  //* put break point on this line..    
})();
console.log(t);

And you but a break point where indicated, then run t = 4 in the console, the value 4 then 1 are printed to the console.

Upvotes: 5

Tejesh Alimilli
Tejesh Alimilli

Reputation: 1800

Although both chrome and safari use webkit as their engine, chrome makes its own customizations and additions over it. Live editing of javascript seems to be one of them.

If you look closely the debugging panels in chrome and safari have many other differences as well. A clearly visible change is settings icon present in chrome and thats not available in safari.

Upvotes: 1

ixx
ixx

Reputation: 32273

Currently this is not possible.

Upvotes: 20

Related Questions