Skip to content

Commit

Permalink
Don't modify the User-Agent string for www.netflix.com
Browse files Browse the repository at this point in the history
  • Loading branch information
tpopela committed Mar 1, 2016
1 parent 92f4f49 commit 7d36204
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 11 additions & 9 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ document.addEventListener('DOMContentLoaded', function () {
// inspired with https://developer.chrome.com/extensions/webRequest
chrome.webRequest.onBeforeSendHeaders.addListener(
function(details) {
var headers = details.requestHeaders;
var headersLength = headers.length;

for (var i = 0; i < headersLength; i++) {
if (headers[i].name === 'User-Agent') {
headers[i].value = headers[i].value.replace("; Linux", "; Fedora; Linux");
break;
if (!detail.url.indexOf("www.netflix.com")) {
var headers = details.requestHeaders;
var headersLength = headers.length;

for (var i = 0; i < headersLength; i++) {
if (headers[i].name === 'User-Agent') {
headers[i].value = headers[i].value.replace("; Linux", "; Fedora; Linux");
break;
}
}
return {requestHeaders: headers};
}
return {requestHeaders: headers};
},
{urls: ["<all_urls>"]},
["blocking", "requestHeaders"]);
});
});
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Fedora User Agent",
"description": "Modifies your User-Agent string to contain the name of Fedora Linux distribution.",
"version": "0.0.0.1",
"version": "0.0.0.2",
"permissions": [
"webRequest",
"webRequestBlocking",
Expand All @@ -14,4 +14,4 @@
"128": "fedora_128.png" },
"manifest_version": 2,
"author": "Tomas Popela, [email protected]"
}
}

0 comments on commit 7d36204

Please sign in to comment.