Please help me changing user agent of chromium embedded framework in visual c#. It uses default chromium agent but i want to change it to use my browser name instead.
Yes, Chromium identifies itself as Chrome. Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.52 Safari/537.36. 'Course, the operating system and version are probably going to be different. Follow this answer to receive notifications.
To add CefSharp, go to the Solution Explorer on the Top Right of Visual Studio, then right click on your app (under the solution) and select Manage NuGet Packages. When the search menu appears, type cefsharp , select the WinForms distributtion and install it. Follow the installation setup (accept therms and install).
Use CefSettings.UserAgent. Also it can be configured via "user-agent" command-line switch.
i know its an old question but this might help someone, use the following code to change user-agent of cef-sharp 3x
ChromiumWebBrowser chromiumBrowser;
public Form1()
{
InitializeComponent();
CefSettings cfsettings=new CefSettings();
cfsettings.UserAgent = "My/Custom/User-Agent-AndStuff";
Cef.Initialize(cfsettings);
chromiumBrowser = new CefSharp.WinForms.ChromiumWebBrowser("http://whatsmyuseragent.com/")
{
Dock = DockStyle.Fill,
};
this.Controls.Add(chromiumBrowser);
}
Step by step:
Hope this helps
you can use by this code change the user agent in chromium
CefSettings settings = new CefSettings();
settings.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With