温馨提示×

javascript如何https请求

九三
676
2021-03-03 12:35:53
栏目: 编程语言

javascript如何https请求

在javascript中使用btoa()方法实现https请求,具体方法如下:

function b64EncodeUnicode(str) {

return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,

function(match, p1) {

return String.fromCharCode('0x' + p1);

}));

}

0