Reputation: 4212
Is it possible to have Chrome write the console output to a local file?
If not; Can I make an external call from the console to my server and save it there?
I know this can be done with devtool extended but I would rather do it from console.
Upvotes: 0
Views: 1391
Reputation: 8751
You can't write into a file in a local computer. It will lead to great security flaw.
Best way is to save the data in server.
The following may work, but need some server side work.
(function(console){
var url = "domain.com/../userdata/"
console.save = function(data, filename){
var ajaxreq = new XMLHttpRequest();
ajaxreq.open("POST", url+filename, false);
ajaxreq.onreadystatechange = function ()
{
if(ajaxreq.readyState === 4)
{
if(ajaxreq.status === 200)
{
alert(ajaxreq.responseText);
}
}
}
ajaxreq.send(data);
}
})(console);
Upvotes: 1