Open LinkXSystem opened 3 years ago
网页从服务器拿到数据,需要保存下来,但是不想存在 Cookie 和 LocalStorage,怎么办?这篇文章的方法就是动态生成一张 Canvas 的 PNG 图片,将数据存在里面。
Hijacking HTML canvas and PNG images to store arbitrary text data
本质实现这个功能是,二进制的数据的转换。 在 Canvas 中,一个单元是 [r, g, b, a] 的元组。均支持 0- 255 的范围,那实现这样的一个功能便非常明显。
参考文章:JavaScript深入之new的模拟实现