You can use up-arrow or type the start of a previous command to search your command history in DevTools, but if you don’t recall the command and it’s far away in your history, you can use this method to see all your console history:
- While in DevTools, Undock into separate window (search for it with Ctrl+Shift+P)
- Ctrl+Shift+J to DevTool your DevTools (inceptioooooon)
- Go to the Application tab -> Local Storage -> devtools://devtools
- Double-click or Edit the value of consoleHistory, and copy it
- To unescape the backlashed newlines and quotes, paste it into a variable and print it to console, where a ‘Copy’ button will appear:
history = ["Your console history here"]
console.log( history.join( '\n\n------\n\n' ) ) - Or inject it into a new tab:
var win = window.open();
win.document.body.innerHTML = "<pre>"+ history +"</pre>";
Bonus tip: you can Ctrl+Shift+P Clear console history.
Merci beaucoup 🙂
Haha, this is perfect! But is it possible to increase the history length above 300 records?
MacOS instructions:
1. Open up DevTools (Cmd + Option + I)
2. Undock DevTools window (Cmd + Shift + P and search for «Undock» and select «Undock into separate window»
3. Open up DevTools’ DevTools (Cmd + Option + I)
4. Follow along on Step 3 and beyond above