Take Live webpage screenshot

I am trying to take a screenshot of remote webpage/external domain using html2canvas

My Code

var url = "https://example.com"; // Replace with the URL of the webpage you want to screenshot
var options = {
  useCORS: true,
  allowTaint: true,
  scrollX: 0,
  scrollY: 0,
  width: window.innerWidth,
  height: window.innerHeight,
};
html2canvas(document.body, options).then(canvas => {
  // `canvas` is the screenshot of the webpage, represented as a canvas element
  // You can append the canvas to the document or export it as an image:
  document.body.appendChild(canvas);
  // To export the screenshot as an image file:
  var link = document.createElement("a");
  link.download = "screenshot.png";
  link.href = canvas.toDataURL();
  link.click();
}).catch(error => {
  console.error(error);
});
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>

This code successfully taking the screenshot of web page of this script instead of screenshot of external domain example.com

How do i fix this?