Hi Salvador.
In CEF4 I use GetDefaultCEFUserAgent to get useragent, is there any way to do this in WebView4?
Thanks
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.
Get useragent
- salvadordf
- Posts: 4089
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Get useragent
That function is not using any CEF API function. It just creates the user agent from scratch.
I don't recall any WebView2 API function to get that information at this moment but you can always get the user agent in JavaScript with this :
https://www.w3schools.com/jsref/prop_nav_useragent.asp
See the BrowserHostAppCommunication demo to know how to send the "agent" value to Delphi.
I don't recall any WebView2 API function to get that information at this moment but you can always get the user agent in JavaScript with this :
Code: Select all
let agent = navigator.userAgent;
See the BrowserHostAppCommunication demo to know how to send the "agent" value to Delphi.