I'm looking for a programmatic way to control the Emulation panel within the dev tools so that I can change my CEF browsers useragent, viewport and devicePixelRatio.
In the thread somebody suggests using the chrome.debugger API and sending in commands like
Network.enable
Network.setUserAgentOverride
Page.enable
Page.setDeviceMetricsOverride
I can't find any information here relating to this, but am wondering, is this possible with CEF and if so could you point me in the right direction.
Thanks in advance
Richard
So I've done some more research and think I might have a way.
Probably not news to a lot here, but was for me, turns out that the remote debug port is actually a websocket which you can send messages to.
So, I might be able to do what I want without the need for chrome.debugger which after reading a lot more posts here looks like it needs to be used within a chrome extension which is not supported with CEF.
Its definitely going to work.
Opened the cefclient like this
cefclient.exe --remote-debugging-port=8888
then opened another instance of chrome.
and navigated to
http://localhost:8888/json
that gave me this
allowed me to change the size.
So what I need to find now is the documentation for the version of the protocol implemented by the cef version Im using which is 3.1916.1749, as this documentation
http://src.chromium.org/viewvc/blink/tr ... ion=178062
doesnt match.
Whilst downloading I realised that the Protocol.json doesnt belong to the chromium source but is in fact part of blink.
Further browsing revealed this
http://src.chromium.org/viewvc/blink/br ... ion=170401
So, I think this is what I will use, as it looks like there is one blink branch for each major version of chromium.
Going to let the chromium finish downloading anyway, as it cant hurt and Im sure theres lots to learn in there.
itsthetaste wrote:
Whilst downloading I realised that the Protocol.json doesnt belong to the chromium source but is in fact part of blink.
Further browsing revealed this
http://src.chromium.org/viewvc/blink/br ... ion=170401
So, I think this is what I will use, as it looks like there is one blink branch for each major version of chromium.
Going to let the chromium finish downloading anyway, as it cant hurt and Im sure theres lots to learn in there.
Actually I was half wrong here.
After letting chromium download fully the file is there
src\third_party\WebKit\Source\devtools\protocol.json
Getting it directly from the blink source is probably easier though, but i've got it now and they match each other