Internet Explorer中的备用btoa编码 [英] alternative btoa encoding in Internet Explorer

查看:199
本文介绍了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);
}

这篇关于Internet Explorer中的备用btoa编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆