I've got a winforms app with the ChromiumWebBrowser control, and I've got it working for every external site I've checked. However, when I try to load html from a local .html file, the browser control freezes up and isn't usable. I can't click links or use textboxes, and even the context menu doesn't work on this control.
The control isn't broken as such - I can still load a new URL and won't have any issues. I should point out that the page does load fully, as I've got something in place to pull the full HTML from the page when it loads, but I cannot interact with it.
Is there a reason that this could happen? I've tried using
browser.Load(filepath);
and
string html = File.ReadAllText(path);
browser.LoadHtml(html, "https://test");
Both of these will load the page but neither of them will let me use it. I assumed that CefSharp would support loading local files, was I wrong?
Talk1:
It does support loading local files, there are many options to choose from. Read the general usage guide on the wiki for more details. LoadHtml works fine for me in version 55 and there have been no other reports of problems from upgrading users.
Talk2:
same problem. with a regular url. page is displayed but basically frozen. whats the solution?
Talk3:
sorry. my bad. was using e.Frame.GetSourceAsync.Result. Bad Idea.
Solutions1
Locking up the UI thread? Try this on a backgroundworker:
Invoke(new Action(() => browser.Load(filepath)));