I don't think you're going to find a satisfactory solution to this.
The XHR simply does not behave the way you're expecting it to. If you
want the user to download something of that nature, depending on your
application state integrity, you could simply direct the browser to
the downloadable URL. Or you could open a window and send that window
to the URL, but in either case if you're looking for that sort of
behavior you aren't going to find success with the XHR, just be smooth
with the transition and it won't be much of a difference.
Thinking more on the idea, you could attempt to use an IFRAME but I am
unsure how that would go, but worth a try.
Good luck.
On May 5, 7:13 am, woodman <[EMAIL PROTECTED]> wrote:
> I am using a php script that produce an application/save content :
> -----
> $size = filesize($file_path);
> header("Content-Type: application/save");
> header("Content-Length: $size");
> header("Content-Disposition: attachment; filename=\"$file_name\"");
> header("Content-Transfer-Encoding: binary");
> readfile($file_path);
> exit;
> -----
> when called from 'new Ajax.Request(...', the default browser behavior
> (ask the user to open or save the file) is skipped by prototype.js.
>
> how to keep the default browser behavior when
> response.getHeader('Content-type') == 'application/save'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---