javascript如何https请求

lewis 2019-03-28 19次阅读

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

function b64EncodeUnicode(str) {

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

function(match, p1) {

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

}));

}



发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。