Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alternative btoa encoding in Internet Explorer

Tags:

javascript

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.

like image 925
user2728834 Avatar asked Aug 29 '13 10:08

user2728834


1 Answers

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

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);
}
like image 152
Yogesh Manware Avatar answered Oct 27 '22 21:10

Yogesh Manware