从Google Photo拖放

时间:2018-08-26 19:13:50

标签: javascript html5 canvas google-photos

当我拖放到

之类的画布上时
  ev.preventDefault();
  var url=ev.dataTransfer.getData("Url");
  console.log(url);
  origImage = new Image();
  origImage.onload=initCanvas;
  console.log("set origImage");
  origImage.setAttribute('crossOrigin', 'anonymous');
  origImage.src=url;
  canvas=document.getElementById('canvas');
  ctx=canvas.getContext('2d');
  var origCanvas = document.createElement("canvas");
  origCtx = origCanvas.getContext("2d");
  origCtx.drawImage(origImage,0,0);
  initCanvasPaint();
  console.log("end filedrop");console.log(ctx);

我收到CORS错误

VM347 upload.html:1 Redirect from 'https://photos.google.com/u/1/photo/AF***************Nj' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://my.page.exampel' is therefore not allowed access.

将Google照片加载到画布上是否需要做些特别的事情?

0 个答案:

没有答案