Screenshots with JavaScript

Using the JavaScript library to capture the content on screen

Firstly, the html element will be converted into canvas.




$('#btn').click(function(){
  html2canvas($('#img'), {
    onrendered: function(canvas) {
      var myImage = canvas.toDataURL("image/png");
      window.open(myImage);
      document.body.appendChild(canvas);
    },
    background: '#000000',
    allowTaint: true,
    useCORS: true
  });   
})

你可能感兴趣的:(Screenshots with JavaScript)