Audio autoplay HTML

HTML autoplay Attribute

The autoplay attribute on an tag specifies that the audio starts playing immediately when the page is loaded.

Example

#

An autoplay attribute on an tag.
Note: to avoid surprises, autoplay is disabled on this page. Click 'Try It live' to see it enabled.

copy
copied to clipboard
Try it live

Using autoplay

#

The autoplay attribute specifies that the audio player starts when the page is loaded.

With this attribute, the audio file will start playing even before the entire file is loaded.

Tip: Automatically playing an audio file may surprise users because they are not expecting it.
It is usually best to give the users full control over when to start.

Syntax

#

Browser support

#

Here is when autoplay support started for each browser:

Chrome
4.0Jan 2010
Firefox
3.5Jun 2009
IE/Edge
9.0Mar 2011
Opera
11.5Aug 2011
Safari
4.0Jun 2009

You may also like

#

  • Our HTML audio Tag Reference
  • Our HTML Reference Guide
  • Our HTML Tutorial
Back to
Feedback
Guides
  • HTML Tables
  • HTML Images
  • HTML Color Names
  • HTML Links
  • HTML Tags
  • HTML Lists
  • HTML Forms
  • HTML Buttons
  • HTML Spaces
  • HTML Checkboxes
  • HTML Editors
  • HTML Comments


Video liên quan

Chủ Đề