daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. chrome.webRequest.onHeadersReceived.addListener(function (details) {
  2. for(i=0;i<details.responseHeaders.length;i++)
  3. {
  4. if(details.responseHeaders[i].name.toLocaleLowerCase()=='content-type')
  5. {
  6. alert(details.responseHeaders[i].name); //it works
  7. details.responseHeaders[i].value='text/plain; charset=utf-8';
  8. }
  9. }
  10. return {responseHeaders: details.responseHeaders};
  11. }, {urls: ["<all_urls>"]}, ['responseHeaders']);
  12.    
  13. chrome.webRequest.onHeadersReceived.addListener(function (details) {
  14.     var yeniheaderlar =
  15.         [{
  16.             name : "Content-Security-Policy",
  17.             value : "sil"
  18.         }, {
  19.             name : "Content-Security-Policy-Report-Only",
  20.             value : "sil"
  21.         }, {
  22.             name : "X-Content-Security-Policy",
  23.             value : "sil"
  24.         }, {
  25.             name : "X-WebKit-CSP",
  26.             value : "sil"
  27.         }, {
  28.             name : "X-Frame-Options",
  29.             value : "sil"
  30.         }, {
  31.             name : "X-XSS-Protection",
  32.             value : "sil"
  33.         }, {
  34.             name : "Access-Control-Allow-Origin",
  35.             value : "*"
  36.         }, {
  37.             name : "Access-Control-Allow-Methods",
  38.             value : "POST, GET, OPTIONS, DELETE, PUT"
  39.         }, {
  40.             name : "Access-Control-Allow-Headers",
  41.             value : "*"
  42.         }
  43.     ];
  44.     for (z = 0; z < yeniheaderlar.length; z++) {
  45.         var zamazingo = false;
  46.         for (i = 0; i < details.responseHeaders.length; i++) {
  47.             if (details.responseHeaders[i].name.toLowerCase() == yeniheaderlar[z].name.toLowerCase()) {
  48.                 if (yeniheaderlar[z].value == "sil") {
  49.                     details.responseHeaders.splice(i, 1);
  50.                 } else {
  51.                     details.responseHeaders[i].value = yeniheaderlar[z].value; ;
  52.                 }
  53.                 zamazingo = true;
  54.             }
  55.         }
  56.         if (!zamazingo && (yeniheaderlar[z].value != 'sil')) {
  57.             details.responseHeaders.push(yeniheaderlar[z]);
  58.         }
  59.     }
  60.     return {
  61.         responseHeaders : details.responseHeaders
  62.     };
  63. }, {
  64.     urls : ["<all_urls>"],
  65.     types : ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"]
  66. },
  67.     ["blocking", "responseHeaders"]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top