Pushing Updates From Event Log To Webpage Not Working In Ie8
In my MVC4 application I have some code to push a new entry in the eventlog to a webpage with SignalR. This code works in FireFox, but in IE8 when a new event is added to the event
Solution 1:
forEach
is not supported in IE8 you need to polyfill
Like suggested here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
if (!Array.prototype.forEach)
{
Array.prototype.forEach = function(fun /*, thisArg */)
{
"use strict";
if (this === void0 || this === null)
thrownewTypeError();
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== "function")
thrownewTypeError();
var thisArg = arguments.length >= 2 ? arguments[1] : void0;
for (var i = 0; i < len; i++)
{
if (i in t)
fun.call(thisArg, t[i], i, t);
}
};
}
Or perform and standard for
loop, something like:
this.notifyListeners = function (queryName, evt) {
var item={};
for (i=0;i<registeredListeners.length;i++){
item = registeredListeners[i];
if (item.queryName === queryName) {
item.listener.newEvent(evt);
}
}
};
Post a Comment for "Pushing Updates From Event Log To Webpage Not Working In Ie8"