I've a servlet that is invoked via jquery ajax. The resulting XML is t开发者_StackOverflowhen transformed using XSL and displayed on screen. Now, the requirement is to either print or save this content to the local machine. The print portion is working fine but I'm stuck at the Save As part. How do I do this using jquery/javascript? I'm using IE8/XP.
I tried
document.execCommand('SaveAs');
on button click but it doesn't seem to work in IE8. It shows the alerts I put in till that point, but doesn't bring up the dialog box. What's going wrong here?
If you can do this using server-side code instead of javascript then set the content-disposition header:
Content-Disposition: attachment
精彩评论