Most Powerful Open Source ERP

Re: 'btoa' is undefined

  • Last Update:2013-12-10
  • Version:001
  • Language:en
Document Reference
Re: 'btoa' is undefined
Publication Information
Embedded
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???