http header spoofer in chrome -


i trying develop chrome tool spoof http request , response headers. request spoofing works fine. code changes ua in request header in response header can't change anything. e.g. trying change "set-cookie" won't work. have used 2 codes response. here's code:

request

var requestfilter = {     urls: [ "<all_urls>" ]   },    extrainfospec = ['requestheaders','blocking'],    handler = function( details ) {      var headers = details.requestheaders,       blockingresponse = {};      for( var = 0, l = headers.length; < l; ++i ) {       if( headers[i].name == 'user-agent' ) {         headers[i].value = 's';         break;       }     }      blockingresponse.requestheaders = headers;     return blockingresponse;   };  chrome.webrequest.onbeforesendheaders.addlistener( handler, requestfilter, extrainfospec ); 

response

    chrome.webrequest.onheadersreceived.addlistener(function(details){     details.responseheaders[details.responseheaders.length] = {name: 'set-cookie', value: 'some random value'};     return {responseheaders: details.responseheaders};      },{urls:["<all_urls>"],types:["xmlhttprequest","sub_frame"]},     ["responseheaders","blocking"]);  

response 2

    var responselistener = function(details){     var rule = {         "name": "set-cookie",         "value": "some random value"     };     details.responseheaders.push(rule);     return {responseheaders: details.responseheaders};     };      chrome.webrequest.onheadersreceived.addlistener(responselistener,      {urls: [   "*://*/*" ] },      ["blocking", "responseheaders"]); 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -