Internet Explorer just keeps biting us web developers in the ass and we have no choice but to find work arounds.
After toying around with SignalR on my MVC3 application, I tested things out in IE 8. Surprise surpise. It didn’t work.
When you run your application in Internet Explorer you’ll see this dreaded icon on the bottom left.
Hit refresh and this window will pop up. You can now see what’s causing things to go south. It’s the signalR.min.js file, line 1, position 161.
Let’s open up that file and see what’s on that line:
if (!t.JSON) throw"SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8."
The SignalR team bless their heart, great documentation. Simple enough, we need the json2.js library.
Using NuGet search for the json2.js file and install it.
Now let’s head over to the area where I’m referencing the signalr.js file, and call json2.js before it, like so:
And you’re done. Hit the refresh button on IE and you’re asynchronous voodoo will work without a hitch. Thoughts, suggestions for improvement? Leave me a comment.