如何为ie8添加Int32Array支持

时间:2013-09-22 06:46:29

标签: javascript internet-explorer-8

我正在使用scrypt.js进行密码加密,在IE8中(显然也是IE9)给出了:

Int32Array is undefined

我已经用Google搜索了,这简直不受ie8和ie9的支持,我应该怀疑是否可以通过某种方式在ie8中添加对javascript的Int32Array支持? 任何线索都赞赏。

1 个答案:

答案 0 :(得分:0)

if(typeof(Int32Array) == "undefined")
{
    Int32Array = function(size)
    {
        if(size < 0 || Math.floor(size) != size) { throw "Invalid array length"; } 
        for(var index = 0; index < size; index++) { this[index] = 0; }
        this.length = size;
    };
    Int32Array.prototype = new Array();
}