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.
Two proxies in the same application
Two proxies in the same application
How to make two different proxies in the same application?
In one form, and on it two browsers.
Or is this not possible?
In one form, and on it two browsers.
Or is this not possible?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
Hi,
Yes, it is possible to have several browsers using different proxy settings but you have to create the browsers with a different request context.
The MDIBrowser demo has all the code you need. Read the code comments in TChildForm.FormShow.
Yes, it is possible to have several browsers using different proxy settings but you have to create the browsers with a different request context.
The MDIBrowser demo has all the code you need. Read the code comments in TChildForm.FormShow.
Re: Two proxies in the same application
Nice!
How to use a single folder with the cookies for both browsers?
How to use a single folder with the cookies for both browsers?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
I'm afraid that's not possible.
The browsers can share the cache and cookies directories only if they have the same request context.
The browsers can share the cache and cookies directories only if they have the same request context.
Re: Two proxies in the same application
Hi!
How do I specify different Cookie paths?TCefRequestContextRef.New(PathCache, '', False, False, False, False)
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
TChromium.CreateBrowser has a parameter called "aCookiesPath" to set the cookies path.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
If two browsers in different processes use the same cache then you will probably get errors, lockups or cache corruption.
Two browsers in the same process can share the same cache.
That's correct. That's how you create a web browser in "incognito" mode because all cache is in memory only.Winexcel wrote: Mon Mar 26, 2018 2:27 pm And what will happen if i don't use a cache directory at all?
I mean that a cache in memory.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
Sorry, I had to edit the last comment about cache sharing.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
The cache is handled internally by Chromium.Winexcel wrote: Mon Mar 26, 2018 2:41 pmWill a cache be free when I close a TFMXChromium instance? Or is it in memory until I closed my application?salvadordf wrote: Mon Mar 26, 2018 2:32 pm That's correct. That's how you create a web browser in "incognito" mode because all cache is in memory only.
I guess it's kept in memory until you close your app or Chromium considers that it has to reduce the memory usage or some cache element is stale.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Two proxies in the same application
I'm sorry for not explaining this more clearly. I'll give a couple of examples :
- One app is executed once but it creates several browsers in different tabs : In this situation you can share the cache between all the browsers because they share the same context by default.
- One app is executed several times at the same moment and each instance creates one browser : In this situation you can't share the cache between different browsers because they use different contexts.
CEF3 only allows to call "cef_execute_process" once per process which means that you can have only one GlobalCEFApp per application.
GlobalCEFApp creates a global context that is used by all the browsers in that application unless you create a different context for each browser.
All browsers in that app that use the same context share the same cache without problems.
if one app creates several browsers with different contexts but they use the same cache directory then you will probably have errors, lockups or cache corruption.