Note that there are some explanatory texts on larger screens.

plurals
  1. POForce download in Google Chrome Extension
    primarykey
    data
    text
    <p>I'm writing an Google Chrome extension that lets you download a backup file of your data. I want the user to be able to press a button and a "Save as" dialog box should open and they can save the file to their computer. Nothing appears to work and I have not found an answer on the internet. I have tried several approaches:</p> <ol> <li>Using <code>document.execCommand('SaveAs', null, 'filename.json');</code> This does not work because this command is IE-only and there does not appear to be a Webkit-alternative</li> <li>Using <strong>data URIs</strong>. This was the most promising and worked in Opera and Firefox, but the problem being that neither Chrome nor Safari appear to support the Content-disposition=attachment;-header in the URI. This <strong>should</strong> work. (Chrome doesn't even allow me to <code>ctrl/cmd+s</code> a page from a data URI)</li> <li>Using an <code>XMLHTTPRequest</code>. I haven't tried this, but there has to be some way in which you could relay the request around? Please note that I do not want to use an external server (in that case I could have simply sent a POST-request and applied a Content-disposition:-header)</li> <li>Using an available Chrome Extension API. But there does not seem to be anything for this purpose.</li> </ol> <p>The reason I don't want to use any external server is that I don't want to have to pay for the hosting, and the data sent might be sensitive to the user, and I don't want infringe on anyone's privacy.</p> <p>Has anyone gotten this to work?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload