Closed pvmnd closed 2 years ago
@pvmnd what is your desired behavior by setting a custom UA and applying the ReduceUserAgent
flag? I would expect only one of those to win.
It seems like for HTTP, the custom UA wins, but for JS, the reduced UA flag wins. Consistency would be nice, but I it seems like a bug to combine those two flags.
miketaylr, I've applied ReduceUserAgent flag in order to enable User Agent Reduction feature expecting to see how this feature will behave after roll out of Phase 6. I can also enable it in chrome://flags/#reduce-user-agent and have the same behavior as I described above.
I expect applying --user-agent flag should win in both JS and request header, otherwise there in no reason to have --user-agent flag. Also this behavior was promised earlier in this comment: https://bugs.chromium.org/p/chromium/issues/detail?id=955620#c10
@pvmnd would you mind filing a new crbug.com? It's still not 100% clear to me what your expected behavior is, but we can fix the bug where navigator.userAgent
doesn't reflect the custom UA via --user-agent
.
Describe the issue
navigator.userAgent
in JS does not match User-Agent header when Custom User-Agent was set in --user-agentEnvironment:
To Reproduce Run chrome with the following flags:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --user-agent="Custom UA test" --enable-features=ReduceUserAgent
Open devTools and visit https://www.google.com/ Check value ofnavigator.userAgent
in console Actual result:navigator.userAgent
has value of 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36'Note: In request header is as expected:
User-Agent: Custom UA test
Expected behavior
navigator.userAgent
should have value of "Custom UA test"Screenshots