Subscribe to Sergio Tapia - Lost in the GC.        RSS Feed
-----

SignalR doesn't work in IE - Internet Explorer.

Icon 2 Comments
Typical.

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.

Posted Image

Click it, and you'll be taken to the error window, showing you what went wrong. Go ahead and tick the little checkbox so that window fires up immediately after any javascript errors. We're trying to find the exact culprit.

Posted Image

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.

Posted Image

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.

Posted Image

Now let's head over to the area where I'm referencing the signalr.js file, and call json2.js before it, like so:

<!-- Used for SignalR -->
<script src="../../Scripts/json2.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.signalR.min.js" type="text/javascript"></script>



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.

2 Comments On This Entry

Page 1 of 1

WolfCoder Icon

03 September 2011 - 10:33 AM
I don't read Spanish.
0

Sergio Tapia Icon

03 September 2011 - 12:12 PM
I don't read Japanese. Your point?
1
Page 1 of 1

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

1 user(s) viewing

1 Guests
0 member(s)
0 anonymous member(s)

About Me

Posted Image


Bienvenidos! I'm a USA ex-pat living in Bolivia for the past 10 years. Web development is my forte with a heavy lean for usability and optimization. I'm fluent in both English and Spanish. I guest write for the popular Python website Python Central. Visit my website.

Categories