活动海报页要把商品图、二维码和标题拼成一张图给用户保存,导出走 canvas.toDataURL('image/png')。上线第二天运营反馈部分用户点了没反应,控制台一行红字:Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. 同源的商品图没事,只有 CDN 那批图会把画布画脏...
商品海报生成器点「复制图片」,Chrome 121 控制台抛 NotAllowedError: The request is not allowed by the user agent or the platform in the current context。同一次点击里纯文本复制是好的,换成图片一定失败。
第一反应是权限,查 permissions.query 的 clipboard-write 状态是 granted,页面也是 https。把 wr...