AngularJS IE11- (ONLY) SyntaxError on ng-view div when opening WebSockets socketHelper

A strange error cropped up today. The Angular 1 JS WebSocket() based application worked fine on all browser exception Internet Explorer 11. The error reported was as such:

SyntaxError <div class="ng-scope" ng-view="">
{
 ABORT_ERR: 20,
 code: <Permission denied>,
 constructor: { },
 ...

Far from actually being a syntax error, the actual cause turned out to be a missing / (forward slash) in the WebSocket connection creation call to:

conn = new WebSocket('ws:/localhost:3001');

This of course should have been:

conn = new WebSocket('ws://localhost:3001');

Only Internet Explorer 8 – 11 experienced this error. Whilst there is a definite syntax error in specifying a websocket url, it’s hard to tell if the error is perhaps bubbling up or causing an unrelated issue further along the command sequence.

Advertisements

Leave a Reply