dcef3 icon indicating copy to clipboard operation
dcef3 copied to clipboard

User Agent, change it?

Open z505 opened this issue 8 years ago • 3 comments

A few people have wondered how to change the user agent and found the only way to do it is to modify it directly in the sources itself.

Are you planning on adding a way to change the user agent, even if it is only possible at the beginning stages of loading the component and not for every page load? It would be a really handy feature.

For example see this: http://stackoverflow.com/questions/18709218/changing-the-user-agent-in-chromium-embedded-3-dcef3-cefvcl/40102319

The only way people have found currently to change the agent is to modify your sources directly by editing settings.user_agent := cefstring('new agent'); in ceflib.pas

z505 avatar Oct 30 '16 01:10 z505

I've just added out solution to that stackoverflow question: http://stackoverflow.com/a/40325259/47631

I hope this helps.

nevcook avatar Oct 30 '16 01:10 nevcook

I do so,

CefUserAgent := 'Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'
if (Ceflibrary <> '') and (not CefLoadLibDefault) then
    Exit;

enjoy it :-)

ghost avatar Oct 30 '16 08:10 ghost

Thanks, I thought maybe the control itself (TChromium component) should have a feature at design time on the delphi form.... to set it visually... but, then the issue would be, it is only possible to set it during initialization of a unit AFAIK, not any point in time. i.e. if you load a new web browser page, can't change it on the fly before next page loading. Must be done only once as it is part of initialization of CefLoadLib

z505 avatar Oct 30 '16 20:10 z505