Sharing one browser instance between multiple applications?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Sharing one browser instance between multiple applications?

Postby DrivingRoads » Tue Jun 23, 2020 3:21 pm

Hello,

My CEF application allows multiple instances. My problem is that cookies and local storage are not shared between instances. I think that is because each instance has its own Browser Process.

How can I share cookies and local storage between instances? Do I need to somehow share a single Browser Process across all my application instances? How can I do that?

Thanks
DrivingRoads
Newbie
 
Posts: 5
Joined: Tue Jun 23, 2020 2:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby magreenblatt » Tue Jun 23, 2020 5:00 pm

You should make your application a single instance that launches multiple windows as needed.
magreenblatt
Site Admin
 
Posts: 10180
Joined: Fri May 29, 2009 6:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby DrivingRoads » Tue Jun 23, 2020 5:26 pm

magreenblatt wrote:You should make your application a single instance that launches multiple windows as needed.


Unfortunately that's not an option, the other contributors have decided that we need multiple instances. (They want it so that, if one instance freezes or crashes, the rest still work.)
DrivingRoads
Newbie
 
Posts: 5
Joined: Tue Jun 23, 2020 2:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby amaitland » Tue Jun 23, 2020 5:38 pm

Only a single process can access the cache at a time.
Maintainer of the CefSharp project.
amaitland
Master
 
Posts: 744
Joined: Wed Jan 14, 2015 2:35 am

Re: Sharing one browser instance between multiple applicatio

Postby DrivingRoads » Tue Jun 23, 2020 5:50 pm

amaitland wrote:Only a single process can access the cache at a time.


Is it possible to launch a single Browser Process, and then have all the instances use that one process?

Kind-of like how multiple Render Processes share a single Browser Process.
DrivingRoads
Newbie
 
Posts: 5
Joined: Tue Jun 23, 2020 2:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby magreenblatt » Tue Jun 23, 2020 6:06 pm

That depends on your OS. If you’re using Windows then you can parent windows across processes. I don’t believe that’s possible on macOS, and I’m not sure about Linux.
magreenblatt
Site Admin
 
Posts: 10180
Joined: Fri May 29, 2009 6:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby ndesktop » Wed Jun 24, 2020 3:25 am

You might use a background process reconciling the caches between multiple instances.
ndesktop
Expert
 
Posts: 403
Joined: Thu Dec 03, 2015 10:10 am

Re: Sharing one browser instance between multiple applicatio

Postby DrivingRoads » Wed Jun 24, 2020 9:55 am

magreenblatt wrote:That depends on your OS. If you’re using Windows then you can parent windows across processes. I don’t believe that’s possible on macOS, and I’m not sure about Linux.


I like this idea. Can you please expand on it a little? I don't understand how the process that owns the Browser Process (I guess the parent window?) would share that instance with new application processes.

---------------------------------------------

ndesktop wrote:You might use a background process reconciling the caches between multiple instances.


I'm not really following, can you clarify?
DrivingRoads
Newbie
 
Posts: 5
Joined: Tue Jun 23, 2020 2:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby magreenblatt » Wed Jun 24, 2020 10:25 am

DrivingRoads wrote:
magreenblatt wrote:That depends on your OS. If you’re using Windows then you can parent windows across processes. I don’t believe that’s possible on macOS, and I’m not sure about Linux.


I like this idea. Can you please expand on it a little? I don't understand how the process that owns the Browser Process (I guess the parent window?) would share that instance with new application processes.

You would have a single process that owns/creates the browser windows. That process would parent those windows (via SetParent) to an HWND (numeric value) owned/created by the different process.
magreenblatt
Site Admin
 
Posts: 10180
Joined: Fri May 29, 2009 6:57 pm

Re: Sharing one browser instance between multiple applicatio

Postby DrivingRoads » Wed Jun 24, 2020 1:21 pm

magreenblatt wrote:
DrivingRoads wrote:
magreenblatt wrote:That depends on your OS. If you’re using Windows then you can parent windows across processes. I don’t believe that’s possible on macOS, and I’m not sure about Linux.


I like this idea. Can you please expand on it a little? I don't understand how the process that owns the Browser Process (I guess the parent window?) would share that instance with new application processes.

You would have a single process that owns/creates the browser windows. That process would parent those windows (via SetParent) to an HWND (numeric value) owned/created by the different process.


Ah I see, thank you very much.
DrivingRoads
Newbie
 
Posts: 5
Joined: Tue Jun 23, 2020 2:57 pm

Next

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Voltageist and 31 guests