Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom handling of Chrome error pages #3852

Open
digorydoo opened this issue Dec 3, 2024 · 1 comment
Open

Custom handling of Chrome error pages #3852

digorydoo opened this issue Dec 3, 2024 · 1 comment
Labels
enhancement Enhancement request

Comments

@digorydoo
Copy link

In previous versions of CEF, the page stayed blank when an error occurred. I implemented OnLoadError and showed my custom error page by loading a data url into the browser.

This worked fine in CEF 123.0.7+g6a21509, but in 131.2.4+gb7543e4 (and maybe earlier), Chrome's error page is first shown, and then replaced by my custom error page. This looks odd to users. Since my own error page can display more specific details about the context, I want to keep mine. Also, the Chrome error pages do not match the style of our corporate design.

Describe the solution you'd like
One solution is to add a flag to CefBrowserSettings that allows me to suppress all Chrome error pages and get the old behaviour back.

settings.allow_chrome_error_pages = false;

Describe alternatives you've considered
Alternatively (or in addition), I'd like an overridable method somehwere that allows me to return the HTML of the error page for a given error.

CefString CefLoadHandler::OnMakeErrorPage(
   CefRefPtr<CefBrowser> browser,
   CefRefPtr<CefFrame> frame,
   ErrorCode errCode,
   const CefString &errText,
   const CefString &failedUrl,
   const CefString &strChromeErrorPage)
{
    return strChromeErrorPage; // either modify or completely replace it with new HTML
}
@digorydoo digorydoo added the enhancement Enhancement request label Dec 3, 2024
@magreenblatt
Copy link
Collaborator

Adding a callback to replace the default HTML is probably the best option here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement request
Projects
None yet
Development

No branches or pull requests

2 participants