Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

请问 JavaScript 能获取 当前网页的请求头吗?

请问 JavaScript 能获取 当前网页的请求头吗? Request Hearders ,而不是 Response Hearders 。

heart_dict = {
    'accept':'application/json, text/javascript, */*; q=0.01',
    'accept-encoding':'gzip, deflate, br',
    'accept-language':'zh-CN,zh;q=0.9',
    'content-length':'309',
    'content-type':'application/x-www-form-urlencoded; charset=UTF-8',
    'origin':'https://trade.xxxx.com',
    'referer':'https://trade.xxxx.com/trade/itemlist/list_sold_items.htm?spm=686.1000925.a1zvx.d28.9VG8CJ&mytmenu=ymbb',
    'sec-fetch-dest':'empty',
    'sec-fetch-mode':'cors',
    'sec-fetch-site':'same-origin',
    'user-agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
    'x-requested-with':'XMLHttpRequest',
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. 没图
  2. 可以取到一部分,不过是通过其它途径,比如 userAgent 之类。无法完整获取当前页面请求头。

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...