Skip to content

Commit

Permalink
make user-agent check case insenstive (#161)
Browse files Browse the repository at this point in the history
Looks & works fine, thanks @andymckay !
  • Loading branch information
Andy McKay authored and wbamberg committed Dec 12, 2016
1 parent dd22610 commit 62cd6d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions user-agent-rewriter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## What it does

This extension uses the webRequest API to rewrite the browser's User Agent header, but only when visiting pages under "http://useragentstring.com/".
This extension uses the webRequest API to rewrite the browser's User Agent header, but only when visiting pages under "https://httpbin.org", for example: https://httpbin.org/user-agent

It adds a browser action. The browser action has a popup that lets the user choose one of three browsers: Firefox 41, Chrome 41, and IE 11. When the user chooses a browser, the extension then rewrites the User Agent header so the real browser identifies itself as the chosen browser on the site http://useragentstring.com/.
It adds a browser action. The browser action has a popup that lets the user choose one of three browsers: Firefox 41, Chrome 41, and IE 11. When the user chooses a browser, the extension then rewrites the User Agent header so the real browser identifies itself as the chosen browser on the site https://httpbin.org/.

## What it shows

Expand Down
4 changes: 2 additions & 2 deletions user-agent-rewriter/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/*
This is the page for which we want to rewrite the User-Agent header.
*/
var targetPage = "http://useragentstring.com/*";
var targetPage = "https://httpbin.org/*";

/*
Map browser names to UA strings.
Expand All @@ -24,7 +24,7 @@ Rewrite the User-Agent header to "ua".
*/
function rewriteUserAgentHeader(e) {
for (var header of e.requestHeaders) {
if (header.name == "User-Agent") {
if (header.name.toLowerCase() === "user-agent") {
header.value = ua;
}
}
Expand Down

0 comments on commit 62cd6d0

Please sign in to comment.