Skip to content

Custom handling of Chrome error pages #3852

@digorydoo

Description

@digorydoo

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions