title: Fetching images with JavascriptResponse in CefBrowser (Without downloading twice)
body: <p>I'm attempting to use <a href="https://github.com/cefsharp/CefSharp/tree/master/CefSharp.OffScreen" rel="nofollow"><code>CefSharp</code> (Offscreen)</a> to get image information in a webpage. I'd like to avoid downloading the content twice (I'm aware I can pull the src string from an image tag, and then download the image again). Right now, this is my code:</p>
  
  <pre><code>using (var browser = new ChromiumWebBrowser("http://example.com"))
  {
      //All this does is wait for the entire frame to be loaded.
      await LoadPageAsync(browser);
  
      var res1 = await browser.EvaluateScriptAsync("document.getElementsByTagName('img')[0].src");
      //res1.Result = the source of the image (A string)
  
      var res2 = await browser.EvaluateScriptAsync("document.getElementsByTagName('img')[0]");
      //This causes an APPCRASH on CefSharp.BrowserSubprocess.exe
  }
  </code></pre>
  
  <p>The way I figure it, <code>CefSharp</code> is already downloading these images to render a webpage. I'd like to avoid making a second request to pull these images from the client, and pull them directly from the client. Is this possible? What are the limitations of the <code>JavascriptResponse</code> object, and why is it causing an APPCRASH here?</p>
  
  <p>Some thoughts: I thought about base64 encoding the image and then pulling it out this way, but this would require me to generate a canvas and fill that canvas every time for each image I want, generate a base64 string, bring it to c# as a string, and then decode it back to an image. I don't know how efficient that would be, but I'm hoping there could be a better solution.</p>