簡體   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?

請看這兩個最小的例子

音頻/MPEG

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

音頻/mp3

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

這兩個例子都可以 select 唯一的 MP3,為什么會這樣?

如果我想強制我的用戶只使用 select 一個 MP3 文件,我應該使用哪個代碼片段?

哪一個是最好的?

MP3 只是 MPEG 文件的音頻部分,因此指定audio/mpeg等同於指定audio/mp3

有關媒體格式的更多信息,請參閱MDN 上的這篇文章。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM