Page 1 of 1

Re: Load HTML text from delphi

Posted: Fri Apr 20, 2018 2:18 pm
by salvadordf
Hi,

TChromium has a LoadString procedure that used to be recommended for these cases. It's been a while since the last time I tested it but you would need to call TChromium.LoadURL('about:blank') first and then call TChromium.LoadString with your html code. Try this after you receive the TChormium.AfterCreated event.

If that didn't work you can also use DATA URIs in the TChoromium.LoadURL call. There are many data uri generators in Internet but I just used this to generate a URI with your HTML code :
https://dopiaza.org/tools/datauri/index.php

I modified the mime-type to text/html but try this in the MiniBrowser demo :

Code: Select all

data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4gPGhlYWQ+DQogICAgPHRpdGxlPkxvY2FsaXppbmcgdGhlIE1hcDwvdGl0bGU+DQogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9ImluaXRpYWwtc2NhbGU9MS4wLCB1c2VyLXNjYWxhYmxlPW5vIj4NCiAgICA8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+DQogICAgPHN0eWxlPg0KICAgICAgI21hcCB7ICBoZWlnaHQ6IDEwMCU7ICB9DQogICAgICBodG1sLCBib2R5IHsgICBoZWlnaHQ6IDEwMCU7IG1hcmdpbjogMDsgcGFkZGluZzogMDsgIH0NCiAgICA8L3N0eWxlPg0KICA8L2hlYWQ+DQogIDxib2R5PiA8ZGl2IGlkPSJtYXAiPjwvZGl2Pg0KICAgIDxzY3JpcHQ+DQogICAgICAgZnVuY3Rpb24gaW5pdE1hcCgpIHsNCiAgICAgICAgdmFyIG1hcCA9IG5ldyBnb29nbGUubWFwcy5NYXAoZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ21hcCcpLCB7DQogICAgICAgICAgem9vbTogOCwgY2VudGVyOiB7bGF0OiAzNS43MTcsIGxuZzogMTM5LjczMX0NCiAgICAgICAgfSk7DQogICAgICB9DQogICAgPC9zY3JpcHQ+DQogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vbWFwcy5nb29nbGVhcGlzLmNvbS9tYXBzL2FwaS9qcz9rZXk9QUl6YVN5QnpCVWd5SGxqZUh2NlZVaWs2b0tLeHRKYXFoS1RhVWV3JmNhbGxiYWNrPWluaXRNYXAmbGFuZ3VhZ2U9ZXMmcmVnaW9uPUVTIg0KICAgIGFzeW5jIGRlZmVyPg0KICAgIDwvc2NyaXB0Pg0KICA8L2JvZHk+DQo8L2h0bWw+
If you want to load local resources, consider using the SchemeRegistrationBrowser demo as a template for your app.

Re: Load HTML text from delphi

Posted: Sun Apr 22, 2018 9:08 pm
by dilfich
Why so difficult, why TChromium.LoadString is not satisfied?

Re: Load HTML text from delphi

Posted: Mon Apr 23, 2018 8:21 am
by salvadordf
This is a quote from the CEF3 project maintainer :
http://magpcss.org/ceforum/viewtopic.ph ... 282#p19321
LoadString is problematic with CEF3 due to the multi-process model and the need to create a render process (which does not happen with LoadString).