美文网首页
canvas.toDataURL() Security Erro

canvas.toDataURL() Security Erro

作者: Roct | 来源:发表于2019-06-17 16:04 被阅读0次
    // Webkit will throw security error when image used on canvas and canvas.toDataUrl()
    
    return new Promise((resolve, reject) => {
      let image = new Image();
      img.onload = () => {resolve(image)}
      img.src = `${url}?${Date.now()}`;
      img.crossOrigin = ""
    })
    
    // Webkit will not throw security error when image used on canvas and canvas.toDataUrl()
    
    return new Promise((resolve, reject) => {
      let img = new Image()
      img.onload = () => {resolve(img)}
      img.crossOrigin = ''
      img.src = `${url}?${Date.now()}`
    })
    

    相关文章

      网友评论

          本文标题:canvas.toDataURL() Security Erro

          本文链接:https://www.haomeiwen.com/subject/sgaafctx.html