js獲取HTTP的請求頭信息


http請求頭部信息的獲取方法:

let req = new XMLHttpRequest();
req.open('GET', document.location, false);
req.send(null);
console.log(req)
let content=req.getResponseHeader('content-type')
console.log(content)
var headers = req.getAllResponseHeaders().toLowerCase();
console.log(headers);

 參考鏈接:https://www.bbsmax.com/A/WpdK0OrzVQ/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM