有没有什么办法通过chrome的resourceType来获取所有的mime类型 [英] Is There any way to get all mime type by the resourceType of chrome
问题描述
在chrome api中有许多类型的resourceType,例如
:Document,Stylesheet,Image,Media,Font,Script,TextTrack,XHR,Fetch,EventSource,WebSocket,Manifest,Other。
现在我想知道resourceType包含哪种MIME类型。
我尝试自己除法它,但有太多的mimeType,那么有没有办法通过代码来获得它?
for ex:document→text / html ...
xhr→application / json ...
Image-> image / png,image / jepg ...
font- > application / font-woff ...
非常感谢!!! !!! / div>
在我自己的问题,我找到了处理Chromium使用的WebKit源代码的源代码。
不仅 mimeType
可用于确定 resourceType
,但也可以使用扩展名(来自url)。
-
mimeType
:'文本 / html'
样式表
mimeType
:'text / css'
图片
-
mimeType
开始于:'image /' - 扩展名:jpeg, jpg,svg,gif,png,ico,tiff,tif,bmp
媒体
- 扩展名:webp
strong>
-
mimeType
包含'font' - 扩展名:ttf,otf,ttc,woff
脚本
$ b'b-
mimeType
以'text /'开头(但不是'text / html'也不是'text / css ')或其中包含'script'或'application'
- 扩展名:js
TextTrack , XHR ,抓取, EventSource , WebSocket / strong>是在处理给定资源时由引擎自定义逻辑处理的。
其他是默认值适用于任何不属于以前类别的内容。
源代码可以在这里找到: ./ third_party / WebKit / Source / devtools /front_end/common/ResourceType.js 。
There is many type of resourceType in chrome api, for ex:Document, Stylesheet, Image, Media, Font, Script, TextTrack, XHR, Fetch, EventSource, WebSocket, Manifest, Other.
Now i want to know resourceType include which mime type. i try to division it by myself but there are too many mimeType,so is there any way to get it by code? for ex: document→text/html... xhr→application/json... Image->image/png,image/jepg... font-> application/font-woff...
thank you very much!!!
In the search to an answer to my own question, I found the source code that handle that in the WebKit source code used by Chromium.
Not only the mimeType
can be used to determine the resourceType
but also the extension (from the url).
Document
mimeType
: 'text/html'
Stylesheet
mimeType
: 'text/css'- extension: css, xsl
Image
mimeType
starting with: 'image/'- extension: jpeg, jpg, svg, gif, png, ico, tiff, tif, bmp
Media
- extension: webp
Font
mimeType
having 'font' in it- extension: ttf, otf, ttc, woff
Script
mimeType
starting with 'text/' (but not 'text/html' nor 'text/css') or having 'script' or 'application' in it- extension: js
TextTrack, XHR, Fetch, EventSource, WebSocket and Manifest are handle by custom logic by the engine during the processing of the given resource.
Other is the default for anything not falling in the previous categories.
Source code is availlable here: ./third_party/WebKit/Source/devtools/front_end/common/ResourceType.js.
这篇关于有没有什么办法通过chrome的resourceType来获取所有的mime类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!