Home Email My Account ☎ 480-624-2500

Disable download button for HTML5 audio and video player

May 22, 2019

To disable the dowload button for HTML5 audio and video player add the following to your tag to your audio node.

<audio controls controlsList="nodownload"><source src="song.mp3" type="audio/mpeg"></audio>

<video controls controlsList="nodownload"><source src="video.mp4" type="video/mp4"></video>

 

The <audio> tag supports the full range of standard attributes in HTML5. These attributes are supported by all HTML5 tags, with very few exceptions. They include:

 

accesskey - this specifies a keyboard shortcut for a given element

class - this specifies a classname for a given element, to be used in conjunction with a style sheet

contenteditable - specifies whether a user is allowed to edit the content

contextmenu - specifies the context menu for a given element

dir - specifies the direction of the text for content in a given element

draggable - specifies if a user is allowed to drag a given element

dropzone - specifies the event that occurs when an item or data is dragged and dropped into a given element

hidden - specifies if a given element is hidden or not

id - specifies a unique identification for a given element

lang - specifies a language code for the content in a given element

spellcheck - specifies if a specific element will need to be subjected to a spelling and grammar check

style - defines an inline style for a specific element

tabindex - specifies the tab order of a specific element

title - specifies a title for a specific element

autoplay - if this attribute is included, the audio will begin to play once it is ready

controls - if this one is included, controls for the audio file will be included on the page. 

loop - if this one is included, the audio will loop and play again once it has finished

preload - this one has three parameters: auto, which plays once it has loaded, metadata, which only displays the data associated with the audio file, and none, which means it will not preload

src - this one's value is simply the URL of the audio file you wish to play