How to pop up a Download Window

Hi all , I have to show window as like you got on click of save(or by pressing of ctrl+s), which exact function like the crtl+s press. Please let me know if anyone having any idea regarding this. It would be great help for me.

Thanks In Advance.

Kumar Saurav wrote:

I have to show window as like you got on click of save(or by pressing of ctrl+s), which exact function like the crtl+s press. Please let me know if anyone having any idea regarding this. It would be great help for me.

If your user can hit the Submit button of a form - maybe labeled "Save" - the controller's action can call send_file. This returns to the user as the "Save As Dialog", which is what you describe.

If your form depends on Ajax, you can add a tiny 1px <iframe> into your form. The Save button has this iframe as a _target, and calls a similar action via form Submit - not Ajax. The action will render a file with send_file, and send it to the <iframe>, which will pop up the Save As dialog. That is how you can use Save As without interrupting a page that uses Ajax.