mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-17 23:08:33 +02:00
make user-agent check case insenstive (#161)
Looks & works fine, thanks @andymckay !
This commit is contained in:
@@ -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.
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user