Is it possible to simulate Devtools 'Toggle Device Toolbar', using CEF4Delphi ? If so, how ?
I mean that button on Chrome Devtools where you can simulate other devices, like phones.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Toggle Device Bar
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Toggle Device Bar
Hi,
That feature is not supported by CEF curently :
https://magpcss.org/ceforum/viewtopic.p ... 29&p=34001
https://bitbucket.org/chromiumembedded/ ... missing-in
That feature is not supported by CEF curently :
https://magpcss.org/ceforum/viewtopic.p ... 29&p=34001
https://bitbucket.org/chromiumembedded/ ... missing-in
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Toggle Device Bar
Besides change the user agent, what else this option does ? It seems there are more things involved that simply changing the user agent, as i could not replicate 100% this feature by only changing the user agent... 

- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Toggle Device Bar
I'm not an expert but I guess the browser resolution and browser scale should be different too.
I haven't tried but --device-scale-factor seems to be used to force the renderer to use a fixed scale factor.
If that factor is calculated using the same formula as the scale factor in OSR mode then you have to do this : new_scale_factor = custom_DPI / 96
I haven't tried but --device-scale-factor seems to be used to force the renderer to use a fixed scale factor.
If that factor is calculated using the same formula as the scale factor in OSR mode then you have to do this : new_scale_factor = custom_DPI / 96
-
- Posts: 513
- Joined: Thu Aug 10, 2017 12:40 pm
Re: Toggle Device Bar
Thank you, will try this !
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Toggle Device Bar
Instead of a normal browser that would get the real screen resolution in your PC, try a browser in OSR mode.
Set the fake screen resolution in the TChromium.OnGetScreenInfo event and use the same size in the TChromium.OnGetViewRect event.
You can set the fake scale in those events too.
You will need to modify the TChromium.OnGetScreenPoint event too to use the fake resolution and scale.
Other events would have to be modified too. For example, you would need to convert the mouse coordinates to the new fake scale.
Set the fake screen resolution in the TChromium.OnGetScreenInfo event and use the same size in the TChromium.OnGetViewRect event.
You can set the fake scale in those events too.
You will need to modify the TChromium.OnGetScreenPoint event too to use the fake resolution and scale.
Other events would have to be modified too. For example, you would need to convert the mouse coordinates to the new fake scale.