Changing the UserAgent

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: Changing the UserAgent

Postby magreenblatt » Tue Apr 15, 2014 1:51 pm

TheoR74 wrote:
magreenblatt wrote:
TheoR74 wrote:Is there a way to Just Append to the current user agent information?

No.


Then, is there a away to get the current value before making a change? Or is it not really set at that point? Basically, all I want to do is append to the browser cap, the name of my custom browser along with the other information.

You'll need to retrieve the current value from something like about:version and store it in a hard-coded string in your application.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Changing the UserAgent

Postby TheoR74 » Fri Apr 18, 2014 4:29 pm

You'll need to retrieve the current value from something like about:version and store it in a hard-coded string in your application.


Any thoughts on how to do that?
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: Changing the UserAgent

Postby TheoR74 » Thu Apr 24, 2014 2:03 pm

I found that you can change the "product name" like this:

Code: Select all
CefString(&settings.product_version).FromASCII("MyTestBrowser/3.0");


Then the browser is identified as "MyTestBrowser Version 3.0" instead of the Chrome name. Just thought I'd share this in case anyone else was looking for how to do this.
TheoR74
Techie
 
Posts: 15
Joined: Wed Apr 09, 2014 11:22 am

Re: Changing the UserAgent

Postby iboinas » Fri Mar 11, 2016 11:52 am

Hi TherR74,

I registered just to thank you, you saved the day!!

Code: Select all
  CefString(&settings.product_version).FromASCII("MyTestBrowser/3.0");

  // Initialize CEF.
  CefInitialize(main_args, settings, app.get());
iboinas
Newbie
 
Posts: 1
Joined: Fri Mar 11, 2016 11:51 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 102 guests