On Mon, Nov 15, 2010 at 1:45 PM, Bill Moseley <moseley at hank.org> wrote: > I have a file upload that uses the hidden iframe appraoch. The twist is > that the response to the upload will return json (details about the upload). > > Currently, I have code that renders json and sets the appliation/json > content-type and that is used for all other AJAX requests. But for the > upload, if the content type comes back as application/json then the browser > will prompt to save the "file", so the work-around seems to be to return a > text/* type of content type. > > My question is this: is it possible to return a correct content type > (applcation/json) and not have browsers ask to save? In other words, is > there a better approach than using an incorrect text/* content type? In my opinion, if you are using the iframe approach, you should be returning HTML and the JSON should be included within <script> tags. You would then access the content using the DOM. Returning other types of documents in an iframe is a questionable use of the element. -- Matt Warden Austin, TX, USA http://mattwarden.com This email proudly and graciously contributes to entropy.