Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Customize error message

Post Reply
User avatar
danicarla2
Posts: 19
Joined: Mon Oct 01, 2018 6:01 pm
Location: Brazil

Customize error message

Post by danicarla2 »

Hi guys...

How do I customize an error message?
He display a blank page if the computer is offline, how to customize this page?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Customize error message

Post by salvadordf »

Hi,

You can use the TChromium.OnLoadError event to load a custom web page.

Read this forum thread for more details :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=571
User avatar
danicarla2
Posts: 19
Joined: Mon Oct 01, 2018 6:01 pm
Location: Brazil

Re: Customize error message

Post by danicarla2 »

When MiniBrowser is offline open a blank page, if I right click and go to "View page source" it displays this code

Code: Select all

<html><head></head><body></body></html>
I like only change this code to

Code: Select all

<html><head></head><body>Internet disconnected :(</body></html>
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Customize error message

Post by salvadordf »

Use TChromium.OnLoadError and check the value of errorCode.

If errorCode is ERR_INTERNET_DISCONNECTED, ERR_ADDRESS_UNREACHABLE, etc... then call TChromium.LoadURL('file://c:/path/error.html');

The file c:/path/error.html can have the contents you mentioned.

Take a look at uCEFConstants.pas for more error codes :
https://github.com/salvadordf/CEF4Delph ... stants.pas
User avatar
danicarla2
Posts: 19
Joined: Mon Oct 01, 2018 6:01 pm
Location: Brazil

Re: Customize error message

Post by danicarla2 »

Thanks, with your help I got it ;)
Post Reply