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.
I found the answer.
You can configure IE8 to display application/json in the browser window by updating the registry. There’s no need for an external tool. I haven’t tested this broadly, but it works with IE8 on Vista.
To use this, remember, all the usual caveats about updating the registry apply. Stop IE. Then, cut and paste the following into a file, by the name of
json-ie.reg.Then double-click the .reg file. Restart IE. The new behavior you get when tickling a URL that returns a doc with
Content-Type: application/jsonorContent-Type: text/jsonis like this:What it does, why it works:
The
25336920-03F9-11cf-8FD0-00AA00686F13is the CLSID for the “Browse in place” action. Basically this registry entry is telling IE that for docs that have a mime type of application/json, just view it in place. This won’t affect any application/json documents downloaded via<script>tags, or via XHR, and so on.The CLSID and Encoding keys get the same values used for
image/gif,image/jpeg, andtext/html.This hint came from this site, and from Microsoft’s article Handling MIME Types in Internet Explorer .
In FF, you don’t need an external add-on either. You can just use the
view-source:pseudo-protocol. Enter a URL like this into the address bar:This pseudo-protocol used to be supported in IE, also, until WinXP-sp2, when Microsoft disabled it for security reasons.