Saturday, 28 May 2011

sMash: Enforce a save as window to download a file

When you are implementing a REST service using sMash and you need send back a JSON object (or any other) and you need to enforce the browser to show the "Save as" window and specify a default file name too e.g. sample.js, then include the following line of code:

request.headers.out."Content-Disposition" = "attachment; filename=sample.js"; 

No comments:

Post a Comment