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

Post Reply
alpires2000
Posts: 48
Joined: Sat Dec 09, 2017 4:40 pm

Get useragent

Post by alpires2000 »

Hi Salvador.
In CEF4 I use GetDefaultCEFUserAgent to get useragent, is there any way to do this in WebView4?
Thanks
User avatar
salvadordf
Posts: 4079
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Get useragent

Post by salvadordf »

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 :

Code: Select all

let agent = navigator.userAgent;
https://www.w3schools.com/jsref/prop_nav_useragent.asp

See the BrowserHostAppCommunication demo to know how to send the "agent" value to Delphi.
Post Reply