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.

Proxy

pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: Proxy

Post by pushca »

Hi! My question is: can I request the "*.pac" file from the local directory next to my application?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

I've never done that. Try using a FILE or DATA URL in GlobalWebView2Loader.ProxySettings.PacUrl.

In any case, WebView4Delphi uses the same command line switches as Chromium to configure the proxy settings.

If you find a way to configure a proxy in Chrome/Chromium with those switches then you should be able to use the same trick in WebView4Delphi.
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: Proxy

Post by pushca »

Hello. I use a proxy to work with the browser. My proxies require authorization. I use some solutions that handle this. Not so long ago I got experience with nodejs.js and chromium browser - there are browser commands page.authenticate(login,password). I noticed that the browser on that system and what is used here are very similar and thought that maybe there are these commands here. Could you give me a hint ?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

The WebView2 API doesn't have any function to handle proxy settings.

For now, all we can do is use Chromium command line switches, execute JavaScript code and DevTools methods to try to find workarounds for this and any other missing API features.

I haven't tried "page.authenticate" but I guess you should be able to execute it like any other JavaScript code.
3vr
Posts: 11
Joined: Mon Feb 26, 2024 7:56 pm

Re: Proxy

Post by 3vr »

How do I set username and password?
I tried different formats, such as user:password@IP:PORT, but without success.

Another question, to change the proxy, is it necessary to recreate the browser every time?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

3vr wrote: Wed Aug 28, 2024 3:41 pm How do I set username and password?
I tried different formats, such as user:password@IP:PORT, but without success.
WebView2 doesn't have an API method to set the proxy settings and we have to use command line switches.

There's a known issue with proxy authentication :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/3667
https://github.com/MicrosoftEdge/WebView2Feedback/issues/1205
https://github.com/MicrosoftEdge/WebView2Feedback/issues/132
https://github.com/MicrosoftEdge/WebView2Feedback/issues/193
https://github.com/MicrosoftEdge/WebView2Feedback/issues/120
3vr wrote: Wed Aug 28, 2024 3:41 pm Another question, to change the proxy, is it necessary to recreate the browser every time?
At his moment, I'm afraid this is the only way.
Post Reply