Most Powerful Open Source ERP

'btoa' is undefined

  • Last Update:2016-02-01
  • Version:001
  • Language:en
1 - 6 6 条记录
概要

If your browser does not have native base64 converter ("btoa" and "atob"), like Internet Explorer 9, you can import this script to your html page and associate Base64 methods to global functions.

<html>
  <head>
    <script type="text/javascript" src="webtoolkit.base64.js"></script>
    <script type="text/javascript">
      <!--
      if (typeof btoa === "undefined") {
        _keyStr = Base64._keyStr;
        btoa = Base64.encode;
        atob = Base64.decode;
      }
      // -->
    </script>
  </head>
  <body>
    <!-- ... -->
  </body>
</html>

Let me know if there is better solutions!

From: Tristan Cavelier

If your browser does not have native base64 converter ("btoa" and "atob"), like Internet Explorer 9, you can import this script to your html page and associate Base64 methods to global functions.

<html>
  <head>
    <script type="text/javascript" src="webtoolkit.base64.js"></script>
    <script type="text/javascript">
      <!--
      if (typeof btoa === "undefined") {
        _keyStr = Base64._keyStr;
        btoa = Base64.encode;
        atob = Base64.decode;
      }
      // -->
    </script>
  </head>
  <body>
    <!-- ... -->
  </body>
</html>

Let me know if there is better solutions!

how to implement this method???

 

Here you'll find different implementations of btoa and atob [base64.js].

From: Tristan Cavelier

 

Here you'll find different implementations of btoa and atob [base64.js].


when i use the above script i get the following error "SCRIPT5009: 'Uint8Array' is undefined". Please tell me how to fix this.

Which version of Internet Explorer do you use? 

Hello, you should at least use Internet Explorer 10.

Indeed, jIO uses the newest html5 technologies, and Internet Explorer is quite slow to implement these features.

You can use the very useful website caniuse.com to know from which version of browser to use for a choosen function.