-
Notifications
You must be signed in to change notification settings - Fork 576
Description
Describe the bug
This bug is described in this forum thread - https://magpcss.org/ceforum/viewtopic.php?f=6&t=18880. The thread has a post from a user that debugged the issue and describes why the problem is occurring.
I am experiencing the exact behavior described here using CefSharp 115.3.130. I tried using the workaround described in the thread of creating a browser instance with a new CefRequestContext and specifying the accept language list in the CefRequestContextSettings, and while this did address the Accept-Langauge issue it also caused a number of other more significant issues and had to be reverted.
To Reproduce
Steps to reproduce the behavior:
- In SimpleApp::OnContextInitialized, add this line before before CreateBrowser call:
CefString(&browser_settings.accept_language_list) = "de";
- Build & run, confirm Google homepage is shown in German
- In SimpleHandler.h, add CefRequestHandler and CefResourceRequestHandler to list of base classes and override GetRequestHandler & GetResourceRequestHandler:
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() override {
return this;
}
virtual CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_navigation,
bool is_download,
const CefString& request_initiator,
bool& disable_default_handling) override {
return this;
}
- Build & run again, Google homepage is now in English. Checking request headers with dev tools Network tab shows Accept-Language is using default value of en-US.
Expected behavior
The CefBrowserSettings.accept_language_list is respected when using a ResourceRequestHandler
Versions (please complete the following information):
- OS: Windows 10
- CEF Version: 115.3.13
Additional context
Does the problem reproduce with the cefclient or cefsimple sample application at the same version?
Yes - the initial post on the forum thread describes how to reproduce the issue with cefsimple
Does the problem reproduce with Google Chrome at the same version?
No
Add any other context about the problem here.