Hello friends, how can I open a website in a mobile version? (as if it were a smartphone)
Thank you
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.
open a web page in mobile version
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: open a web page in mobile version
Hi,
As far as I know, the DevTools option to simulate other devices is not supported by CEF but you can try creating an OSR browser with the same dimensions and screen scale settings. You may also need to change the user agent string.
These DevTools methodds might be handy too :
https://chromedevtools.github.io/devtools-protocol/tot/Emulation/
As far as I know, the DevTools option to simulate other devices is not supported by CEF but you can try creating an OSR browser with the same dimensions and screen scale settings. You may also need to change the user agent string.
These DevTools methodds might be handy too :
https://chromedevtools.github.io/devtools-protocol/tot/Emulation/
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: open a web page in mobile version
I did some more testing and the new "Chrome runtime" mode does support the device emulation!
Run the TinyBrowser2 demo to see that option when you inspect a web page.

Run the TinyBrowser2 demo to see that option when you inspect a web page.
Re: open a web page in mobile version
Hello friends, thanks for your answers at the moment this code is working for me, now the browser opens in mobile version
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.cache := 'cache';
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.UserAgent := 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
end;

procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.cache := 'cache';
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.UserAgent := 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1';
end;