简体   繁体   English

为什么 HTML `<input type="“file”"> 如果我只想 select MP3,`accept property`audio/mpeg` 和 `audio/mp3` 的工作方式相同吗?

[英]Why HTML `<input type=“file” />` accept property `audio/mpeg` and `audio/mp3` works the same if I just want to select MP3?

Please see these two minimum examples请看这两个最小的例子

audio/mpeg音频/MPEG

 <input type="file" accept="audio/mpeg">

audio/mp3音频/mp3

 <input type="file" accept="audio/mp3">

Both examples can select the only MP3, why is this happening?这两个例子都可以 select 唯一的 MP3,为什么会这样?

If I want to force my user to just select an MP3 file, which code snippet should I use?如果我想强制我的用户只使用 select 一个 MP3 文件,我应该使用哪个代码片段?

Which one is the best?哪一个是最好的?

An MP3 is just the audio portion of a MPEG file, so specifying audio/mpeg is equivalent to specifying audio/mp3 . MP3 只是 MPEG 文件的音频部分,因此指定audio/mpeg等同于指定audio/mp3

More info about media formats can be found in this article on MDN.有关媒体格式的更多信息,请参阅MDN 上的这篇文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM