HTML <audio> autoplayAttribute

HTML audio 标签参考手册HTML <audio> Tag

Examples

An audio element set to autoplay:

<audio controls autoplay> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg">Your browser does not support the audio element.</audio>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Internet Explorer 9+, Firefox, Opera, Chrome, and Safari support the autoplay attribute.

Note:Internet Explorer 8 and earlier versions do not support the <audio> tag.


Definition and Usage

The autoplay attribute specifies that the audio will start playing as soon as it is ready.

If this attribute is set, the audio will play automatically.


Differences between HTML 4.01 and HTML 5

The autoplay attribute is new in HTML 5.


Differences between HTML and XHTML

In XHTML, attribute minimization is not allowed, and the autoplay attribute must be defined as <audio autoplay="autoplay">.


Syntax

<audio autoplay>


HTML audio 标签参考手册HTML <audio> Tag

Other Extensions