I am trying to watch my javascript code using the console.log(text)
command - and it does work... but the console gets flushed everytime the url changes.
Is there any way to persist my console logs between page changes?
You need to open the developer tools with Ctrl + Alt (or Cmd + Option) + I. As of Chrome 70 (and maybe before that) the settings cog is at the top right of the console window. Click it, and then click 'Preserve log'.
log() with Examples. 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.
log() The console. log() method outputs a message to the web console. The message may be a single string (with optional substitution values), or it may be any one or more JavaScript objects.
Click on the bottom-right corner gear icon in the Chrome developers tool, check 'Preserve log upon navigation' option and you are done.
For the record, these days both Firefox and Chrome have 'persist' options in their inspectors / conosole. You need to right click in the console window and then select the relevant option tfrom the popup menu.
There isn't a way to do this yet but from what I've read it is a future feature they will implement. Here is the Issue ticket on it: http://code.google.com/p/chromium/issues/detail?id=77058
EDIT: Chrome has implemented this feature. Read the answer below
There's only 1 way that I know of, but not with Chrome: With the built-in Web Inspector in Firefox 4+, which doesn't flush the logs between pages.
@scrappedcola notes that Firebug does this as well, but I'm referring to the built-in inspector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With