Default page loaded after hitting OnLoadError

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Default page loaded after hitting OnLoadError

Postby JRub » Mon Sep 24, 2012 6:30 am

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.
CEF 3.1453.1255 on Windows 7 32bits
JRub
Mentor
 
Posts: 92
Joined: Wed Sep 19, 2012 8:32 am
Location: Paris, France

Re: Default page loaded after hitting OnLoadError

Postby Czarek » Mon Sep 24, 2012 7:01 am

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
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: Default page loaded after hitting OnLoadError

Postby JRub » Mon Sep 24, 2012 7:20 am

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.
CEF 3.1453.1255 on Windows 7 32bits
JRub
Mentor
 
Posts: 92
Joined: Wed Sep 19, 2012 8:32 am
Location: Paris, France


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 27 guests