Wagner Andreas
Wagner Andreas

Reputation: 11

CefSharp possible to load html content?

I need to create a application which loads a html "template" file and parse them with current data values. So far no problemm but does anyone knows how to load the parsed html value into the cefsharp browser ?

I found some old topics here with an "loadHtml()" function. But this function isnt there anymore.

Thanks in advance

Upvotes: 0

Views: 1556

Answers (2)

amaitland
amaitland

Reputation: 4420

You need to add a using CefSharp; statement to your code to access the LoadHtml extensions methods.

chromiumWebBrowser.LoadHtml(html);

Upvotes: 1

David Sdot
David Sdot

Reputation: 2333

const string html = "<html><head><title>Test</title></head><body><h1>Html Encoded in URL!</h1></body></html>";
var base64EncodedHtml = Convert.ToBase64String(Encoding.UTF8.GetBytes(html));
browser.Load("data:text/html;base64," + base64EncodedHtml);

From the project wiki on github: Loading HTML/CSS/JavaScript/etc from disk/database/embedded resource/stream

Upvotes: 0

Related Questions