multi cookie & read bug
js cookie
multi cookie & read bug
document.cookie;
// "access_token_test=eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiRGV2ZWxvcGVyIiwiZXhwaXJlZCI6MTU0MDAxNTg4MjgwMSwiYXV0aCI6WyJwdWJsaXNoIl0sInVzZXJfbmFtZSI6Inh4eHgiLCJ0b2tlbl9rZXkiOiJhY2Nlc3NfdG9rZW5fdGVzdCIsImVtYWlsIjpudWxsfQ.HZUwdyOU3rqpr_bkQZfMdlDFwY7iC8fQKlqxRTCc5Ek; access_token_prod=eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiQWRtaW4iLCJleHBpcmVkIjoxNTQwMDE2MDkzODA5LCJhdXRoIjpbInB1Ymxpc2giLCJvcGVyYXRpb24iLCJhY2NvdW50Il0sInVzZXJfbmFtZSI6ImFkbWluIiwidG9rZW5fa2V5IjoiYWNjZXNzX3Rva2VuX3Byb2QiLCJlbWFpbCI6bnVsbH0.qzDBwIld35c62ip-SG7jDz4vzqCOEyLyeux9dVLVxmU"
JWT
https://github.com/js-cookie/js-cookie
https://www.npmjs.com/package/js-cookie
https://www.w3schools.com/js/js_cookies.asp
multi cookie
read bug
https://github.com/js-cookie/js-cookie
$ npm i js-cookie
$ npm i -S js-cookie
cookie getter
a more simple cookie getter method!
https://www.w3schools.com/js/js_cookies.asp
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
npm bug
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/9816179.html
未经授权禁止转载,违者必究!