View JSON in Internet Explorer 7-11

[Origin]: http://developers.de/blogs/holger_vetter/archive/2013/12/13/view-json-in-internet-explorer-7-11.aspx

Hello guys,

you all know the problem, want to debug an application with IE and IE always wants to download the JSON file.

The other browsers like Chrome or Firefox are doing a better job here.

If you want that IE shows the JSON file without downloading it, here is a registry fix for it.

Create a new text document and insert this (Link: http://pastebin.com/B0BXG0N6):

Windows Registry Editor Version 5.00;
; Tell IE 7,8,9,10,11 to open JSON documents in the browser on Windows XP and later.
; 25336920-03F9-11cf-8FD0-00AA00686F13 is the CLSID for the "Browse in place" .
;
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00

[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=hex:08,00,00,00

Now rename the document to {FileName}.reg and save.

Run it and confirm the dialog.

Now JSON files will be shown directly in IE, without downloading.

*Thanks to Coding 101 from http://www.codeproject.com/Tips/216175/View-JSON-in-Internet-Explorer for the Script

Problems in IE11 with compatibility mode?

https://github.com/carhartl/jquery-cookie/issues/277

0x800a01b6 – JavaScript runtime error: Object doesn’t support property or method ‘addEventListener’

Oops, you’re right that was a copy paste error. However I trigger the compatibility mode via the Settings Icon -> Compatibility View Settings -> Add the site in there.

From there on he doesn’t show the div whereas without the comp mode it works without any problems.

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

is set.

“Object doesn’t support this property or method” error in IE11

http://stackoverflow.com/questions/18829292/object-doesnt-support-this-property-or-method-error-in-ie11

Best way to solve this until a fix is available (if a fix comes) is to force IE compatibility mode on the user.

Use

<META http-equiv="X-UA-Compatible" content="IE=9>

ideally in the masterpage so all pages in your site get the workaround.

shareedit
2
This works, just tested with IE11, I added it to the _Layout.cshtml page –  Manny Mar 27 at 16:37

http://stackoverflow.com/questions/24533729/jquery-2-1-1-in-ie9-get-error-0x800a01b6-microsoft-jscript-runtime-error-obj

You can add below code in your web config file for setting document mode:

<system.webServer>
  <httpProtocol>
    <customHeaders>
     <add name="X-UA-Compatible" value="IE=EmulateIE9">
    <customHeaders>
 <httpProtocol>
<system.webServer>
shareedit

Don’t use runAllManagedModulesForAllRequests=”true” when getting your MVC routing to work

http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html

Don’t use runAllManagedModulesForAllRequests=”true” when getting your MVC routing to work

It seems to be common advice to make your modules section of your web.config say <modules runAllManagedModulesForAllRequests="true">. In fact this is quite a drastic thing to do to solve the routing problem and has global effects that could CAUSE ERRORS.

You need a module that goes by the name of UrlRoutingModule-4.0 to be running through IIS. Now, since your MVC URLs are likely to end without .aspx these will not be picked up by IIS and run through the intergrated pipeline and therefore you will end up with 404 not found errors. I struggled with this when I was getting started until I found the <modules runAllManagedModulesForAllRequests="true"> workaround.

This highly recommended fix can cause other problems. These problems come in the form of making all your registered HTTP modules run on every request, not just managed requests (e.g. .aspx). This means modules will run on ever .jpg .gif .css .html .pdf etc.

This is:

  1. a waste of resources if this wasn’t the intended use of your other modules
  2. a potential for errors from new unexpected behaviour.

Better solution

Fine, so the ranting about <modules runAllManagedModulesForAllRequests="true"> is over. What is a better solution?

In the modules section of your web.config, you can add the UrlRoutingModule-4.0 module in with a blank precondition meaning it will run on all requests. You will probably need to remove it first since it is most likely already registered at machine level. So make your web.config look like this:

<modules>
  <remove name="UrlRoutingModule-4.0" />
  <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
  <!-- any other modules you want to run in MVC e.g. FormsAuthentication, Roles etc. -->
</modules>

Note: the modules element does NOT contain the runAllManagedModulesForAllRequests=”true” attribute because it is evil!