showing results for - "how to take screenshots in the browser using javascript"
Giorgio
29 Mar 2016
1const screenshotTarget = document.body;
2
3html2canvas(screenshotTarget).then((canvas) => {
4    const base64image = canvas.toDataURL("image/png");
5    window.location.href = base64image;
6});
Janet
29 Oct 2020
1const capture = async () => {
2  const canvas = document.createElement("canvas");
3  const context = canvas.getContext("2d");
4  const video = document.createElement("video");
5
6  try {
7    const captureStream = await navigator.mediaDevices.getDisplayMedia();
8    video.srcObject = captureStream;
9    context.drawImage(video, 0, 0, window.width, window.height);
10    const frame = canvas.toDataURL("image/png");
11    captureStream.getTracks().forEach(track => track.stop());
12    window.location.href = frame;
13  } catch (err) {
14    console.error("Error: " + err);
15  }
16};
17
18capture();
Finn
07 Apr 2019
1const url2png = require('url2png')('API_KEY', 'PRIVATE_KEY');
2const fs = require('fs');
3
4app.get('/screenshot', (req, res) => {
5	url2png.readURL(req.query.url, {}).pipe(fs.createWriteStream('screenshot.png'));
6	res.json({success: true})
7});
queries leading to this page
take screenshot via javascripthow to take screenshot from javascripttaking screenshot with jshow to take screenshot with javascriptcapture screenshot using javascriptjavascript take screenshotjavascript screenshot of pagecan you take a screenshot javascriptvideo screenshot javascriptcapture screenshot in javascripthow to take screenshot of entire screen with javascriptjavascript taking screenshottake screenshot of video javascriptscreenshot with javascriptfull page screenshot javascriptjavascript code to capture a screenshot from the browserhow to make screenshot window app using jsjavascript take screenshot of pagehow can i take a screenshot with javascriptwebsite screenshot javascripthow to capture the screenshot of a webpage in html page using javascriptjavascript take screenshot of webpagejs capture screenshotwindow screenshot javascriptweb page screenshot javascriptprint screenshot javascripthow to take a screenshot using jsscreenshot of current browser window javascriptscreenshot with jshow to take screenshot of webpage using javascripttake screenshot in javascriptjavascript capture element screenshottake a screenshot using javascriptjs take screenshothtml screenshot javascripthow to take screenshot of browser using javascripttake screenshot using javascripthow to make a screenshot image of a website using javascripthow to take screenshot in jsjavascript screenshot of webpagescreenshot in javascripthow to create screenshot with javascripthow to make screenshot of video on html page using javascripttake screenshot of web page javascriptjs screenshot pagetake screenshot from jsjs take screenshot of page browser screenshot jsjs do screenshottake screenshot of webpage using javascriptjavascript screenshotscreenshot using javascriptjavascript take screenshot of web pagetake screenshot jshow to take screenshot of html page using javascripttake a screenshot of a website jsmake screenshot of a website javascripttake screenshot of html element javascripttake screenshot javascriptjavascript create screenshot of pagehow tp take screenshot in jsscreenshot javascripthow to make screenshot app using jsjavascript take screenshot of current pagescreenshot browser javascriptjavascript screenshot pagecapture screenshot in html javascriptjs screenshot scripthow to take screenshot browser secreen with javascriptjs website screenshot as imghow to take a screenshot using javascriptjavascript take screenshot of websiteis there a way to screenshot using jshow to take screenshots in the browser using javascript