Forrest Lee
Forrest Lee

Reputation: 21

Modifying the User Agent String in Chromium source code

Where in the Chromium source code can I modify the browser's User Agent String?

I am working with the Mac OS. Also, I do not want to append to the User Agent. Essentially, I want to change the UA enough so that a website still thinks it is Chrome (as is standard with Chromium UA), while it is not chrome.

I have had issues with appending a unique identifier in that it causes many websites to block my access.

Upvotes: 2

Views: 3464

Answers (2)

Asesh
Asesh

Reputation: 3361

Like dangered wolf mentioned, Google Chrome and Chromium build and retrieve user agent from this method BuildUserAgentFromOSAndProduct : Build Chromium's user-agent

And this is where Chrome will retrieve the final Chrome/version string from GetProductNameAndVersionForUserAgent : Retrieve Chrome/version string for user-agent

Upvotes: 2

dangered wolf
dangered wolf

Reputation: 33

This is definitely an old question, but it's a question I too have been searching for an answer for. Since StackOverflow results appear in Google search results, and that there isn't another question like this, it's a good idea to document it for others.

It's currently located in content\common\user_agent.cc

It used to be located in webkit\glue\user_agent.cc, but was moved around when Google forked it to make Blink.

Upvotes: 3

Related Questions