Initialize multiple instances of CefSharp

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.

Initialize multiple instances of CefSharp

Postby eurus » Sun Aug 05, 2018 3:51 am

hi, i using CefSharp 65
i need initialize cef.initialize multiple because my project use multi browser loading and i need to load multi user agent and multi path for each browser,Is there a way to solve this problem?
eurus
Newbie
 
Posts: 1
Joined: Sun Aug 05, 2018 3:48 am

Re: Initialize multiple instances of CefSharp

Postby Czarek » Mon Aug 06, 2018 2:05 am

Initialize may be called only once during app lifetime, thus only a global user agent for all browsers is supported. However it seems supporting unique user agent per browser is possible. User agent is kept in two places: request headers and navigator.userAgent js object. You can modify headers using CefRequestHandler.OnBeforeResourceLoad and you can modify navigator.userAgent by injecting custom js code e.g. in CefLoadHandler.OnLoadStart. Btw. this is not a CefSharp support forum.
Last edited by Czarek on Wed Aug 08, 2018 2:08 am, edited 1 time in total.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Initialize multiple instances of CefSharp

Postby ndesktop » Mon Aug 06, 2018 4:27 pm

Czarek wrote:You can modify headers using CefRequestHandler

... but beware of request IsReadOnly. This can happen during initialization phase.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 112 guests