Last Updated: December 24, 2019
· ollieglass

Add to Chrome

Need to export some data from the browser console?

Open Sources -> Snippets in the console, right click to make a new file. Call it consoleSave.js


Paste the JavaScript code below into the snippet (or get the latest version from

Right click on consoleSave.js and run the snippet.

Voila, now you can call to
download objects from the console!


(function(console){ = function(data, filename){

        if(!data) {
            console.error(' No data')

        if(!filename) filename = 'console.json'

        if(typeof data === "object"){
            data = JSON.stringify(data, undefined, 4)

        var blob = new Blob([data], {type: 'text/json'}),
            e    = document.createEvent('MouseEvents'),
            a    = document.createElement('a') = filename
        a.href = window.URL.createObjectURL(blob)
        a.dataset.downloadurl =  ['text/json',, a.href].join(':')
        e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)

1 Response
Add your response

Nice. I'll try this out. It is always good when you're debugging js issues to be able to save the console output. Now I won't have to copy paste all of them. Thanks!

over 1 year ago ·