试过window.atob(x);
where x
is "A"
, "AA"
, "AAA"
, 等等。为什么浏览器会说:
VM156:1 未捕获的 DOMException:无法在 'Window' 上执行 'atob':要解码的字符串未正确编码。
当字符串长度为 1, 5, 9, 13, 17, ...
["A","AA","AAA","AAAA","AAAAA","AAAAAA","AAAAAAA"].forEach(function(str) {
console.log(str.length,str);
try {
console.log(atob(str));
}
catch(e) {
console.log(e.message);
}
});