Open Bug 2003841 Opened 18 hours ago

Custom User-Agent header set via JavaScript is ignored when Firefox Mobile is in "Desktop site" mode

Categories

(Firefox for Android :: General, defect)

Firefox 145
All
Android
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tomacat, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0

Steps to reproduce:

  1. The following Javascript I wrote to set "User-Agent" request header via fetch():
url = "https://example.com/";
fetch(url, {
    cache: 'no-store',
    headers: {"User-Agent": navigator.userAgent + " UserAgentNewString/1.0"}
});
  1. On Firefox Mobile, "Desktop site" is off. The sent HTTP request header is:
    User-Agent: Mozilla/5.0 (Android 14; Mobile; rv:145.0) Gecko/145.0 Firefox/145.0 UserAgentNewString/1.0

  2. On Firefox Mobile, "Desktop site" is on. The sent HTTP request header is:
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0

Actual results:

When "Desktop site" is on. The custom "User-Agent" header is override, and can't be set.

Expected results:

The custom "User-Agent" header should be set when "Desktop site" is on.

You need to log in before you can comment on or make changes to this bug.