Skip to content

Instantly share code, notes, and snippets.

@nchevobbe
Last active September 4, 2018 13:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nchevobbe/caec501e1bc0f78bd6aad72f414ff1d2 to your computer and use it in GitHub Desktop.
Save nchevobbe/caec501e1bc0f78bd6aad72f414ff1d2 to your computer and use it in GitHub Desktop.
Log a data URL containing a screenshot of the window
let canvas = window.document.createElementNS("http://www.w3.org/1999/xhtml", "html:canvas");
let context = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
context.drawWindow(window, 0, 0, canvas.width, canvas.height, "white");
console.log(`
📸 📸 📸 📸
${canvas.toDataURL()}
📸 📸 📸 📸
`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment