antvis/G6

引入iconfont使用downloadFullImage在http环境下导出图片icon不显示 #4945

MusicTen posted onGitHub

问题描述

The file at 'blob:http://xxx' was loaded over an insecure connection. This file should be served over HTTPS.

重现链接

https://github.com/antvis/G6/blob/6b1d62c5a92b66c34e72fcfded896a53d89914f2/src/graph/graph.ts#L2371

重现步骤

  1. 引入iconfont
  2. 渲染带icon节点
  3. 使用downloadFullImage导出图片
  4. http环境下导出图片icon丢失
  5. 控制台报错提示同上

预期行为

我期望在http环境下带icon节点导出图片正常,现在本地开发环境是正常的,(线上环境现在还不支持https)。

平台

  • 操作系统: [macOS]
  • 网页浏览器: [Google Chrome]
  • G6 版本: [4.8.20 ]

屏幕截图或视频(可选)

<img width="297" alt="image" src="https://github.com/antvis/G6/assets/37668403/ded23f55-a962-45f1-809b-0debbf7cfb4d">

补充说明(可选)

尝试将chrome网站内容-安全设置-允许不安全内容,未能解决。


定位到原因:http 环境带字体图标的 canvas 转 blob 下载报错(localhost:5173/下载不报错)

const canvas = graph.get('canvas').get('el');
canvas.toBlob((blob: Blob) => {
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.download = '2.png';
  a.href = url;
  a.click();
  URL.revokeObjectURL(url);
});

image

posted by MusicTen over 1 year ago

Fund this Issue

$0.00
Funded

Pull requests