javascript - Internet Explorer 中的替代 btoa 编码

标签 javascript

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

最佳答案

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

还有一些选择,但我想你可以使用 jQuery.base64.js 如下

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

关于javascript - Internet Explorer 中的替代 btoa 编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18508582/

相关文章:

javascript - 更改 <p> 值 onclick 不起作用

javascript - 如何动态内联通过文件加载器加载的 SVG?

javascript - 从 Fetch API 中提取 JSON

javascript - Nodejs 未捕获引用错误 : $ is not defined after var jQuery = require ('jquery' );

javascript - 从 JQuery 中没有标题的对象访问 JSON 对象

javascript - 是否可以将 setTimeout 函数存储在本地存储中?

javascript - Angular 2 : Template not updating after http service update

javascript - 下划线/Lo-Dash _.each 不返回数组

Javascript 全局重置

javascript - Safari - 按箭头键导航图库时发出错误声音