Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 693
adib Avatar asked Sep 20 '10 05:09

adib


People also ask

Does console log work on Safari?

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

Can you console log in JavaScript?

The console. log() is a function in JavaScript which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. Syntax: console.

Why console log is not working in Safari?

Make sure that you're selecting "All" at the top of your console window. Sometimes it'll automatically switch to only show Errors, Warnings, or Logs. If you select "All", then you should see all your console. log() s!


2 Answers

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().

like image 79
Boris Avatar answered Sep 20 '22 15:09

Boris


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).

like image 41
Cristian Sanchez Avatar answered Sep 19 '22 15:09

Cristian Sanchez