Page 1 of 1

Customize error message

Posted: Wed Oct 17, 2018 3:18 pm
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?

Re: Customize error message

Posted: Wed Oct 17, 2018 3:58 pm
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

Re: Customize error message

Posted: Thu Oct 18, 2018 1:29 pm
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>

Re: Customize error message

Posted: Thu Oct 18, 2018 1:36 pm
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

Re: Customize error message

Posted: Thu Oct 18, 2018 6:37 pm
by danicarla2
Thanks, with your help I got it ;)