开发者

Changing Response.Header makes javascript unresponsive on my page

I use

response.AddHeader("content-disposition", "attachment;filename=file.xls");
response.ContentType = "application/vnd.ms-excel";

as a method to generate a CSV/Excel file in my page. It works like a charm, however, after I open the file, the scripts on my page are unresponsive; trying tie J开发者_如何学运维S onclick on any component on my page dosen't work.

Any Ideas/suggestions???


The root cause is the Content Type.

Javascript only works with certain combinations of ContentType ... of which 'js' itself must be a part. Try reverting ContentType dynamically to JS compatible type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜