title: Resizing a HTML canvas blanks its contents
body: <p>I have a HTML canvas element which is resized when the user resizes the screen.</p>
  
  <pre><code>canvas.height = pageHeight();
  canvas.width = pageWidth();
  </code></pre>
  
  <p>The actual resizing works fine, but it blanks the canvas.</p>
  
  <p>I would like to keep the contents. Is there another method of changing the size of a canvas element, or is there a way to store the contents and then draw them back to the canvas?</p>