I am using CefSharp for off-screen rendering of web pages and I would like to execute a JavaScript code before taking a screenshot of the rendered page.
Using browser.EvaluateScriptAsync("document.body.scrollHeight")
on some webpages (for example https://github.com/) unfortunately results in the following error:
Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src assets-cdn.github.com".
@ undefined:0:-1
This apparently happens because of the Content Security Policy header.
According to this answer, it is possible to disable the security in Firefox. Is it also possible to disable it in CEF? Or is it possible to execute scripts in any other way?