Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome extension : Download/export content created "on the fly"

I need to let the user to download a file created on the fly from some data contained in the extension, but I don't want to do this server-side.

As a real-world example : There is a variable containing the text "hello world". I want the user to be able to download/create a .TXT file containing such text.

Is it possible ?

-edited Oct 30, 2010-

Solutions so far:

window.saveAs - not working at all

createObjectURL - works, but the filename and other options can't be customized yet

copy data to clipboard - works, but too many steps are required to the user

create a GoogleDocs document - could work, but needs messing with the API and Oauth

-edited Apr 15, 2011

Looks like things are improving: https://github.com/eligrey/FileSaver.js

But Chrome 14+ is still a bit weird about filenames.

like image 375
Omiod Avatar asked Oct 23 '10 09:10

Omiod


1 Answers

I think the only way is to call save dialog through flash, see Downloadify library.

like image 103
serg Avatar answered Sep 23 '22 08:09

serg