I have a GZipped JavaScript file which I am encoding with a data:URI.
For example:
<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's name to be download.js.gz
. This way when the user double clicks this file (in Mac OS X), it gets decompressed and renamed correctly to download.js
, and they can view the contents easily.
The problem is that when I use the content type text/javascript
(or application/x-javascript
), the file gets saved as download.js
. And when I use the content type application/x-gzip
, the file gets saved as download.gz
.
Is there any way to get the file to be saved as .js.gz
?
Here's a working example of both links: http://jsfiddle.net/xYm8w/3/
The file must be a data uri and not a link to an actual file. I tried changing the text between the <a>
tags, but it doesn't affect anything at all.