jsUtils.base64encode()

Encodes string into base 64 encoding.

jsUtils.base64encode( str )
  str - string to be encoded into base 64 format

Returns encoded string.

The input string will be encoded into base 64 format. This format is very useful to pass data between browser and server and do not worry what kinf of data is being passed. The url parameters have many restrictions and this is one of the way to overcome it. This is the standard base 64 encoding. All modern languages have functions to encode/decode into base 64. Normally, the size of the data increases by 30%.

Example

<!DOCTYPE html>
<html>
<head>
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        var arr = [1, 2, 'string', {}];
        window.onload = function() {
            alert(jsUtils.base64encode(jsUtils.serialize(arr)));
        }
    </script>
<body>
</body>
</html>

See Also