How can I convince IE to simply display application/json rather than offer to download it?
Posted
by Cheeso
on Stack Overflow
See other posts from Stack Overflow
or by Cheeso
Published on 2010-03-20T16:16:49Z
Indexed on
2010/03/20
16:21 UTC
Read the original article
Hit count: 177
While debugging jQuery apps that use AJAX, I often have the need to see the json that is being returned by the service to the browser. So I'll drop the URL for the JSON data into the address bar.
This is nice with ASPNET because in the event of a coding error, I Can see the ASPNET diagostic in the browser:
But when the server-side code works correctly and actually returns JSON, IE prompts me to download it, so I can't see the response.
Can I get IE to NOT do that, in other words, to just display it as if it were plain text?
I know I could do this if I set the Content-Type header to be text/plain
.
But this is specifically an the context of an ASPNET MVC app, which sets the response automagically when I use JsonResult on one of my action methods. Also I kinda want to keep the appropriate content-type, and not change it just to support debugging efforts.
© Stack Overflow or respective owner