html5 file base64,javascript - Why does HTML5 file api provide base64 code? - Stack Overflow

When you use a base64 image, you save a http GET request to the server to download the image from the url, since the img is already embed in base64 inside the tag.

However, a image loaded to the client using base64 encode is 30% heavier, which is really bad if the image is naturaly big because it will increase bandwidth utilization.

Another problem is that base64 images are not cacheable. Hence, the client will always process it each time he opens the page, no matter how many times. Obviously, it will increase CPU time.

As you can see, there is a trade-off to think about. To increase performance, you should use base64 to load only the tiny images, since 30% of a small image is a low increase compared to the overhead of a round-trip http GET request. Then, you save the traditional http get request to the larger ones.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值