Horje
invalidcharactererror: failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded. Code Example
failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded.
function utf8_to_b64( str ) {
    return window.btoa(unescape(encodeURIComponent( str )));
}

function b64_to_utf8( str ) {
    return decodeURIComponent(escape(window.atob( str )));
}

// Usage:
utf8_to_b64('✓ à la mode'); // "4pyTIMOgIGxhIG1vZGU="
b64_to_utf8('4pyTIMOgIGxhIG1vZGU='); // "✓ à la mode"
failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded.
    function b64DecodeUnicode(str) {
        // Going backwards: from bytestream, to percent-encoding, to original string.
        return decodeURIComponent(atob(str).split('').map(function(c) {
            return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
        }).join(''));
    }
    
    b64DecodeUnicode('4pyTIMOgIGxhIG1vZGU='); // "✓ à la mode"
    b64DecodeUnicode('Cg=='); // "\n"
invalidcharactererror: failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded.
$('#link').on('click', function(e){
  this.href = URL.createObjectURL(
    new Blob([document.documentElement.outerHTML] , {type:'text/html'})
  );
});




Javascript

Related
demo api url Code Example demo api url Code Example
tinymce-angular load slow Code Example tinymce-angular load slow Code Example
trim angular material input with ellipsis Code Example trim angular material input with ellipsis Code Example
is undefined false in javascript Code Example is undefined false in javascript Code Example
matrix array javascript Code Example matrix array javascript Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7