我可以通过JavaScript获取图像的文件大小和MIME类型(仅限FireFox / Gecko / Mozilla) [英] Can I get an image's file size and mime-type via JavaScript (FireFox/Gecko/Mozilla only)
本文介绍了我可以通过JavaScript获取图像的文件大小和MIME类型(仅限FireFox / Gecko / Mozilla)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您可以使 HEAD
请求与XHR这将告诉你的文件大小,只要这些图像在您的域名。
Can I get an image's file size and mime-type via JavaScript. I am writing a script for inspecting all images in a document. I will run the script in FireFox only so a solution specific to FireFox (undocumented/non-standard/otherwise) is perfectly acceptable. I can use jQuery if necessary.
解决方案
You could make a HEAD
request with XHR which will tell you the file size, provided these images are on your domain.
这篇关于我可以通过JavaScript获取图像的文件大小和MIME类型(仅限FireFox / Gecko / Mozilla)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文