Reputation: 93
I'm using a javascript implementation of the gzip algorithm which works fine with Firefox and Chrome. But with Internet Explorer I got the following error:
Method forEach is not supported!
Code:
deflate.deflate(data, level).forEach(function (byte) {
putByte(byte, out);
});
I'm using Internet Explorer 9, which should support the forEach Method.
Any ideas?
Thank you very much!
Upvotes: 9
Views: 21640
Reputation: 5996
You might try and extend the Array
object for browsers that don't support the foreach
method on it as suggested here Array.forEach
One example is:
if (!Array.prototype.forEach) {
Array.prototype.forEach = function(fn, scope) {
for(var i = 0, len = this.length; i < len; ++i) {
fn.call(scope, this[i], i, this);
}
}
}
Upvotes: 23
Reputation: 2470
forEach is not supported in IE9, you can try using jquery.
ex:
$. each (function (byte) {
putByte(byte, out);
});
Upvotes: 0