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.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

salvadordf Help !!!

Post Reply
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

salvadordf Help !!!

Post by sodlf159 »

CustomSwitches:= 'Mozilla/5.0 (Linux; Android 14; SM-G991B Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/125.0.5615.138 Mobile Safari/537.36';
GlobalWebView2Loader.AdditionalBrowserArguments := '--user-agent="' + CustomSwitches + '"';
GlobalWebView2Loader.StartWebView2;


https://abrahamjuliot.github.io/creepjs/


GlobalWebView2Loader.StartWebView2; <

The user agent must be changed before it is called.

userAgentData cannot be changed.

Network.setUserAgentOverride

Even if you do that, the service part won't change, but everything else will change properly. ,brand ,version change

CEF4Delphi is the same.

If either of those changes, I'll give you a kiss.

Navigator here userAgentData works fine.

However, the one in the picture is displayed as a windows browser.

Image

https://ibb.co/5xWpqdC
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: salvadordf Help !!!

Post by salvadordf »

Use TWVBrowser.UserAgent in WebView4Delphi

Code: Select all

      /// Returns the User Agent. The default value is the default User Agent of the
      /// Microsoft Edge browser.
      /// This property may be overridden if
      /// the User-Agent header is set in a request. If the parameter is empty
      /// the User Agent will not be updated and the current User Agent will remain.
      /// Setting this property may clear User Agent Client Hints headers
      /// Sec-CH-UA-* and script values from navigator.userAgentData. Current
      /// implementation behavior is subject to change.
      /// The User Agent set will also be effective on service workers
      /// and shared workers associated with the WebView. If there are
      /// multiple WebViews associated with the same service worker or
      /// shared worker, the last User Agent set will be used.

Use GlobalCEFApp.UserAgent in CEF4Delphi.

Both projects have a MobileBrowser demo that shows you how to override some of the browser settings.
sodlf159
Posts: 90
Joined: Thu Nov 09, 2023 1:55 pm

Re: salvadordf Help !!!

Post by sodlf159 »

That's not my opinion.
Please check the image address.
Everything else is completely changed, but

https://abrahamjuliot.github.io/creepjs/ <<

I am curious about how to change the user agent data in Worker.
It is displayed as a window

CustomSwitches:= 'Mozilla/5.0 (Linux; Android 14; SM-G991B Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/125.0.5615.138 Mobile Safari/537.36';
GlobalWebView2Loader.AdditionalBrowserArguments := '--user-agent="' + CustomSwitches + '"';
GlobalWebView2Loader.StartWebView2;

So, the user agent was changed before being called, but the user data was not changed. Is there a way to change it before it is called?
Post Reply