Multiple browser programs, same cookie path: allowed?

Having problems with building or using the JCEF Java binding? Ask your questions here.

Multiple browser programs, same cookie path: allowed?

Postby JohnnyTheHun » Sun Oct 14, 2018 3:48 am

If I have multiple programs
all with an embedded jcef browser showing the same url
AND all programs set the request to use the same cookie path
can this cause some kind of cookie file corruption or other problems? Or is it an allowed scenario?

And am I right to assume that if i do not persist session cookies then all of the above browser instances will have their own session cookies (and sessions)?
JohnnyTheHun
Techie
 
Posts: 19
Joined: Tue Apr 10, 2018 12:24 pm

Re: Multiple browser programs, same cookie path: allowed?

Postby magreenblatt » Sun Oct 14, 2018 7:37 am

Cookie paths cannot be shared across multiple executable instances. You can instead create multiple browsers using the same executable instance, and those can share cookies. Each cookie manager instance will have separate seasion cookies that are not persisted to disk by default.
magreenblatt
Site Admin
 
Posts: 9838
Joined: Fri May 29, 2009 6:57 pm

Re: Multiple browser programs, same cookie path: allowed?

Postby JohnnyTheHun » Thu Aug 22, 2019 4:49 pm

Thanks, I have a quick question about this:
1. So If I use separate cookie managers created with the same cookie path (e.g. c:\...\cookies) for each browser it won't cause a problem?
E.g.
Code: Select all
cookieManager1 = CefCookieManager.createManager("c:/.../cookies", false);
cookieManager2 = CefCookieManager.createManager("c:/.../cookies", false);

browser1 = client_.createBrowser(url, false, false,CefRequestContext.createContext(new CefRequestContextHandlerAdapter() {
 public CefCookieManager getCookieManager() { return cookieManager1 };
});
browser2 = client_.createBrowser(url, false, false,CefRequestContext.createContext(new CefRequestContextHandlerAdapter() {
 public CefCookieManager getCookieManager() { return cookieManager2 };
});



2. I want to create multiple Windows(JFrame) with browsers showing different urls. Would you recommend
- creating 1 CefClient and using that to create multiple browsers
- OR create a new CefClient for each browser instance?
E.g. the detailed example creates a new CefClient if you select the "New Window" in the menubar.

Thank you!
JohnnyTheHun
Techie
 
Posts: 19
Joined: Tue Apr 10, 2018 12:24 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 2 guests