I would like to embed an HTML5 canvas into my C# WinForms app. So far I've found the CefSharp project which appears to do the job quite well but I am having trouble getting it to execute HTML containing javascript calls.
Here is an example of HTML I would like to run in the canvas:
<!DOCTYPE html>
<script src="processing.js"></script>
<canvas data-processing-sources="example.pde"></canvas>
The end goal of this exercise is to run Processing.js locally from the application.
Is it possible to execute javascript locally in CefSharp by providing the HTML to the canvas? If so, what is the easiest way to go about it. This is not an ASP.NET app.
CefSharp has methods ExecuteScript, EvaluateScript and RegisterJsObject but not sure if these can be utilised. I am a sole developer, this is out of my normal field of expertise.
I will also add things I've discovered in case someone would like to comment further or provide clarification:
- Chromium (CefSharp is a C# wrapper) has a security policy in place which can prevent local files from being used. I am not sure if this can be overridden in CefSharp.