Page 1 of 1

salvadordf Help !!!

Posted: Mon Sep 02, 2024 6:06 pm
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

Re: salvadordf Help !!!

Posted: Wed Sep 04, 2024 7:47 am
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.

Re: salvadordf Help !!!

Posted: Wed Sep 04, 2024 4:53 pm
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?