我想知道有没有人试图从jquery(或普通JS)的ajax请求中删除“X-Requested-With”头文件。可能吗?
第二部分:你知道Grease Monkey的ajax请求设置了这个头吗?
谢谢
标题看起来像这样:
X-Requested-With XMLHttpRequest
“2nd part: do you kNow if Grease Monkey’s ajax requests set this header?”
不,Greasemonkey’s GM_xmlhttpRequest()没有设置这个标题(虽然你可以添加它)。
GM_xmlhttpRequest()发出的默认请求看起来就像普通的浏览器请求。
例如:
GM_xmlhttpRequest
({
method: "GET",url: "http://google.com/",onload: function(response) {alert(response.responseText); }
});
看起来像我的数据包嗅探器:
GET / HTTP/1.1
Request Method: GET
Request URI: /
Request Version: HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 115
Connection: keep-alive
Cookie: blah,blah,blah...