setUserAgentOverride not working for new popups

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

setUserAgentOverride not working for new popups

Postby wizofaus » Wed Feb 17, 2016 10:00 pm

I'm trying to use the debugger message Network.setUserAgentOverride to set the user agent, but I can't seem to get it to kick-in for new windows that get created by scripts.
I'm trying to do it as soon as possible (on_load_start), but the navigator.userAgent string is still evaluating as the default.
It's working fine for the initial window, because you can send the debugger message when "about:blank" loads, but nothing of the sort happens when, e.g. javascript on that initial page calls window.open(...).
(Also I found that I had to fire off the function to fetch the debugger url in a background thread because it seems the thread that on_load_start() is called on is the same as the one listening for connections. This might actually be the problem, because there's no way that I can determine to "wait" for the Network.setUserAgentOverride message to be sent)

BTW I know you can set the UserAgent in CefInitialize and this works fine, but I need to be able to switch it on the fly for different browser sessions.
wizofaus
Newbie
 
Posts: 8
Joined: Sun Aug 02, 2015 11:47 pm

Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 11 guests