简体   繁体   中英

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

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

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

chromiumWebBrowser.LoadHtml(html);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM