title: Executing JavaScript to Render HTML for Server-Side Caching
body: <p>There are lots of widgets provided by sites that are effectively bits of JavaScript that generate HTML through <em>DOM</em> manipulation or <code>document.write()</code>. Rather than slow the browser down even more with additional requests and trust yet another provider to be fast, reliable and not change the widget output, I want to execute* the JavaScript to generate the rendered HTML, and then save that HTML source.­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
  
  <p>Things I've looked into that seem unworkable or way too difficult:</p>
  
  <ol>
  <li>The Links Browser (<em>not lynx!</em>)</li>
  <li>Headless use of Xvfb plus Firefox plus Greasemonkey (<em>yikes</em>)</li>
  <li>The all-Java browser toolkit Cobra (<em>the best bet!</em>) </li>
  </ol>
  
  <p>Any ideas? </p>
  
  <p>** Obviously you can't really execute the JavaScript completely, as it doesn't necessarily have an exit path, but you get the idea.</p>