Page 1 of 1

Default page loaded after hitting OnLoadError

PostPosted: Mon Sep 24, 2012 6:30 am
by JRub
Hello,

It seems that after hitting OnLoadError (at least when error is FILE_NOT_FOUND), Chromium automatically loads URL "data:text/html,chromewebdata".
However, I'd like to handle the browser behavior whenever an error occurs.
Is there a way of deactivating this page loading, or at least setting the desired error page ?

I guess I could use OnBeforeResourceLoad to prevent any unsolicited page loading after an error occurred, but I'd prefer using a more appropriate way, if there is one.

Re: Default page loaded after hitting OnLoadError

PostPosted: Mon Sep 24, 2012 7:01 am
by Czarek
Code: Select all
 ///
  // Called when the browser fails to load a resource. |errorCode| is the error
  // code number and |failedUrl| is the URL that failed to load. To provide
  // custom error text assign the text to |errorText| and return true.
  // Otherwise, return false for the default error text. See
  // net\base\net_error_list.h for complete descriptions of the error codes.
  ///
  /*--cef()--*/
  virtual bool OnLoadError(CefRefPtr<CefBrowser> browser,
                           CefRefPtr<CefFrame> frame,
                           ErrorCode errorCode,
                           const CefString& failedUrl,
                           CefString& errorText) { return false; }


To provide custom error text assign the text to |errorText| and return true

Re: Default page loaded after hitting OnLoadError

PostPosted: Mon Sep 24, 2012 7:20 am
by JRub
As I work with CEF3 1180, the declaration for OnLoadError is now:

Code: Select all
///
// Called when the browser fails to load a resource. |errorCode| is the error
// code number, |errorText| is the error text and and |failedUrl| is the URL
// that failed to load. See net\base\net_error_list.h for complete
// descriptions of the error codes.
///
/*--cef(optional_param=errorText)--*/
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
                         CefRefPtr<CefFrame> frame,
                         ErrorCode errorCode,
                         const CefString& errorText,
                         const CefString& failedUrl) {}

Hence I can't do what you suggested.