adib
adib

Reputation: 8395

Log to Safari JavaScript Console

Is there any way to log to Safari's JavaScript console when running with the built-in JavaScript debugger? I've read the Firefox JavaScript logging question and hoping that there is a simple ("native") way to do it in WebKit/Safari.

Thanks

Upvotes: 31

Views: 84112

Answers (3)

user3064538
user3064538

Reputation:

Make sure you have "All" selected in the top right corner of the dev tools.

The top right section of the Safari dev tools If it's set to "Error" then your Safari will only show console.error().

Upvotes: 28

Cristian Sanchez
Cristian Sanchez

Reputation: 32097

You can use the same console object described in that question. The messages will show up in the console tab.

console.log("hello console");

console.log will work "natively" in Firefox (with Firebug), IE8+, and WebKit browsers (including Safari).

Upvotes: 22

Robert
Robert

Reputation: 21388

It works just the same in Safari as it does in Chrome and Firefox. By default the developer tools is not turned on, so make sure you go to Preferences -> Advanced -> Show Develop Menu in Menu Bar. Then you can pull up the console with Command+Option+C. (That shortcut obviously assumes Mac, not sure the PC shortcut, but it's in the dropdown as well)

Upvotes: 24

Related Questions