Internet Explorer中的备用btoa编码

问题描述:

我正在尝试将 http://jsbin.com/ufufez/1/edit 中的相同代码实施到我的环境,它不在IE中工作。有人可以为此提供替代解决方案,使其在IE> 8中工作。

I am trying to implement the same code from http://jsbin.com/ufufez/1/edit into my environment and it's not working in IE. Can someone give an alternate solutions for this to make it work in IE > 8.

不支持window.btoa() on< = IE9。

window.btoa() is not supported on <= IE9.

还有更多选择,但我想你可以使用 jQuery.base64.js 如下所示

There are few more alternatives but I guess you can use jQuery.base64.js as below

if (window.btoa) {
    msg.dataEncoded = window.btoa(msg.data);
} else { //for <= IE9
    msg.dataEncoded = jQuery.base64.encode(msg.data);
}