HighDots Forums  

FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2009-11-03)

Javascript JavaScript language (comp.lang.javascript)


Discuss FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2009-11-03) in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
FAQ server
 
Posts: n/a

Default FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2009-11-03) - 11-02-2009 , 07:00 PM






-----------------------------------------------------------------------
FAQ Topic - How do I prompt a "Save As" dialog for an
accepted mime type?
-----------------------------------------------------------------------

It is not possible with client-side javascript.

Some browsers accept the Content-Disposition header, but this
must be added by the server. Taking the form:-
` Content-Disposition: attachment; filename=filename.ext `

http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html

http://support.microsoft.com/kb/q260519/


The complete comp.lang.javascript FAQ is at
http://jibbering.com/faq/

--

The sendings of these daily posts are proficiently hosted
by http://www.pair.com.

Reply With Quote
  #2  
Old   
Michael Haufe (\TNO\)
 
Posts: n/a

Default Re: FAQ Topic - How do I prompt a "Save As" dialog for an acceptedmime type? (2009-11-03) - 11-03-2009 , 06:17 AM






On Nov 2, 6:00*pm, "FAQ server" <javascr... (AT) dotinternet (DOT) be> wrote:
Quote:
-----------------------------------------------------------------------
FAQ Topic - How do I prompt a "Save As" dialog for an
accepted mime type?
-----------------------------------------------------------------------

It is not possible with client-side javascript.

It is possible for browsers that support data urls.

Reply With Quote
  #3  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2009-11-03) - 11-03-2009 , 09:37 AM



Michael Haufe ("TNO") wrote:

Quote:
On Nov 2, 6:00 pm, "FAQ server" <javascr... (AT) dotinternet (DOT) be> wrote:
-----------------------------------------------------------------------
FAQ Topic - How do I prompt a "Save As" dialog for an
accepted mime type?
-----------------------------------------------------------------------

It is not possible with client-side javascript.

It is possible for browsers that support data urls.
Please enlighten us.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

Reply With Quote
  #4  
Old   
Michael Haufe (\TNO\)
 
Posts: n/a

Default Re: FAQ Topic - How do I prompt a "Save As" dialog for an acceptedmime type? (2009-11-03) - 11-03-2009 , 01:37 PM



On Nov 3, 8:37*am, Thomas 'PointedEars' Lahn <PointedE... (AT) web (DOT) de>
wrote:
Quote:
Michael Haufe ("TNO") wrote:
It is possible for browsers that support data urls.

Please enlighten us.
Example: http://thenewobjective.com/temp/save.html

If this FAQ Topic refers _only_ to prompting a dialog specifically per
mime-type on some white-list, then I apologize. Either way, I think
the method I've shown deserves a mention as an option.

Reply With Quote
  #5  
Old   
Thomas 'PointedEars' Lahn
 
Posts: n/a

Default Re: FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2009-11-03) - 11-04-2009 , 12:34 PM



Michael Haufe ("TNO") wrote:

Quote:
Thomas 'PointedEars' Lahn wrote:
Michael Haufe ("TNO") wrote:
It is possible for browsers that support data urls.

Please enlighten us.

Example: http://thenewobjective.com/temp/save.html

If this FAQ Topic refers _only_ to prompting a dialog specifically per
mime-type on some white-list, then I apologize. Either way, I think
the method I've shown deserves a mention as an option.
Nice hack (and basically known to me), but you will observe two things:

1. The suggested download filename is anything but what would the --
unfortunately -- probably most widely distributed OS, Microsoft Windows,
recognize as an image (or whatever). This would be important, because
especially Windows browsers are then not able to provide a list of
alternative "file types" of the same type class in the "Save As" dialog
(say, you Save-As a JPEG image and be presented with choices from .bmp
to .png, depending on the image filters that are installed.) And I think
mentioning the `Content-Disposition' header was a hint as to that.

2. You, like James T. Kirk, have not solved the scenario but changed the
conditions of the test The effective MIME media type is no longer an
accepted one (any other fantasy type will do as well) to prompt the "Save
As" dialog. So you get a commendation for original thinking ;-)

IMHO, the problem that speaks from the question is a problem with no
solution without additional APIs because resources declared as one of the
accepted MIME types (as in the Accept HTTP header) are usually downloaded
to the cache and (dis)played, not presented for download as a file by
default.

Insofar the given answer ("It is not possible with client-side javascript.")
is imprecise, indeed.

About whether your hack should enter the FAQ, because of the above I am
inclined to say no, but it is not for me to decide.


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.