K
K
KorDen322014-10-07 21:22:56
JavaScript
KorDen32, 2014-10-07 21:22:56

Is it possible in Javascript to save the contents of a variable to a file without calling the server?

I am making a UserScript (Greasemonkey / Tampermonkey) that processes the site page and generates the contents of the CSV file in the variable (roughly speaking: the site has an order history, but there is no possibility to export the history, the option to ask the administration for such a function is unrealistic)
Now the contents of the variable are displayed in text field, the user needs to copy the contents to notepad and save in csv format.
In practice, you can implement saving through your server with a small php file that will receive the contents of the variable in the POST request and return it in response with the Content-Disposition: attachment header.
However, I would like to implement this without the need to contact the server. Found only IE's ActiveX.FSO, which of course does not work for other browsers.
Is it possible? If possible, then how?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2014-10-07
@KorDen32

jsfiddle.net/QW01_01/mxLkfp1w

A
Andrey Ezhgurov, 2014-10-07
@eandr_67

Why don't you like the LocalStorage and/or File API capabilities ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question