I have a GZipped JavaScript file that I encode using a data URI:
For instance:
<a href="data:application/x-gzip;base64,FOO">My Javascript File</a>
When the user right-clicks and saves this file (in Chrome), I would like the resulting file name to be download.js.gz . Thus, when the user double-clicks this file (on Mac OS X), it decomposes and renames correctly to download.js , and they can easily view the contents.
The problem is that when I use the content type text/javascript (or application/x-javascript ), the file is saved as download.js . And when I use the application/x-gzip content type, the file is saved as download.gz .
Can I save the file as .js.gz ?
Here is a working example of both links: http://jsfiddle.net/xYm8w/3/
The file should be the uri of the data, not a link to the actual file. I tried to change the text between the <a> tags, but it does not affect anything.
source share