Skip to content

Instantly share code, notes, and snippets.

Avatar

Julian Descottes juliandescottes

View GitHub Profile
@nchevobbe
nchevobbe / screenshot.js
Last active Sep 4, 2018
Log a data URL containing a screenshot of the window
View screenshot.js
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()}