HTML <audio> โหลดแอตทริบิวต์ ล่วงหน้า
ตัวอย่าง
ผู้เขียนคิดว่าไม่ควรโหลดเสียงเมื่อโหลดหน้า:
<audio controls preload="none">
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
ความหมายและการใช้งาน
แอตทริบิวต์preload
ระบุว่าผู้เขียนคิดว่าควรโหลดไฟล์เสียงหรือไม่และอย่างไรเมื่อโหลดหน้า
คุณลักษณะpreload
นี้ช่วยให้ผู้เขียนสามารถให้คำแนะนำแก่เบราว์เซอร์เกี่ยวกับสิ่งที่เขา/เธอคิดว่าจะนำไปสู่ประสบการณ์การใช้งานที่ดีที่สุด คุณลักษณะนี้อาจถูกละเว้นในบางกรณี
หมายเหตุ:แอตทริบิวต์การโหลดล่วงหน้าจะถูกละเว้นหากautoplay
มีอยู่
รองรับเบราว์เซอร์
ตัวเลขในตารางระบุเบราว์เซอร์รุ่นแรกที่สนับสนุนแอตทริบิวต์อย่างเต็มที่
Attribute | |||||
---|---|---|---|---|---|
preload | 4.0 | 9.0 | 4.0 | 4.0 | 11.5 |
ไวยากรณ์
<audio preload="auto|metadata|none">
ค่าแอตทริบิวต์
Value | Description |
---|---|
auto | The author thinks that the browser should load the entire audio file when the page loads |
metadata | The author thinks that the browser should load only metadata when the page loads |
none | The author thinks that the browser should NOT load the audio file when the page loads |
❮ แท็ก HTML <audio>