Why does this not work in ff/chrome?
javascript: document.execCommand('SaveAs','true','http://www.google.com');
(used as a bookmarklet)
Why does this not work in ff/chrome?
javascript: document.execCommand('SaveAs','true','http://www.google.com');
(used as a bookmarklet)
As Microsoft puts it, "There is no public standard that applies to this method."
execCommand is not completely standardized across browsers. Indeed, execCommand('SaveAs', ...) only seems to be supported on IE. The recommended way to force a save-as would be to use a content-disposition: attachment header, as described in http://www.jtricks.com/bits/content_disposition.html
Since this is part of the HTTP header, you can use it on any file type. If you're using apache, you can add headers using the .htaccess file, as described here. For example:
<FilesMatch "\.pdf$">
<IfModule mod_headers.c>
Header set Content-Disposition "attachment"
# for older browsers
Header set Content-Type "application/octet-stream"
</IfModule>
</FilesMatch>