Drawing images to canvas with img.crossOrigin = “Anonymous” doesn't work

后端 未结 2 1175
南笙
南笙 2020-12-08 15:56

In a client-side standalone JS application, I\'m trying to make it so I can call toDataURL() on a canvas on which I\'ve drawn some images specified by a URL. Ie I can input

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 16:31

    When the server requires authorization to access the images the value should be:

    img.crossOrigin = "Use-Credentials";
    

    Otherwise the browser will give up after receiving HTTP 401.

提交回复
热议问题