onmediaerror Event

This topic documents a feature of HTML+TIME 2.0, which is obsolete as of Windows Internet Explorer 9.

Fires when an element's media file causes any error.


Inline HTML <ELEMENT onmediaerror = "handler(event);" >
Event Property object.onmediaerror = handler;
attachEvent object.attachEvent( "onmediaerror", handler); Internet Explorer only
Named script <SCRIPT FOR = object EVENT = onmediaerror> Internet Explorer only

Event Information

Bubbles No
Cancels No
To invoke Open a page in the browser that contains a media file affected by Introduction to HTML+TIME. The event will fire if there is any problem with the file.
Default action Calls the associated event handler.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

srcElement Gets or sets the object that fired the event.
type Gets or sets the event name from the event object.

Refer to the specific event object for additional event properties.


This event supersedes the onmedialoadfailed event.


This example uses the onmediaerror event to display an error message when the page attempts to load an image from an invalid path.

<HTML XMLNS:t="urn:schemas-microsoft-com:time">
<TITLE>onmediaerror Event</TITLE>

    .time {behavior: url(#default#time2);}
<?IMPORT namespace="t" implementation="#default#time2">

    LINK="#000000" VLINK="#808080" ALINK="#000000">

<t:img ID="oImg" src="\\some\invalid\path.gif" 
	onmediaerror="alert('Media Error--Invalid path to image source file!')"

<t:animation ID="oAnim" targetElement="oImg" to="0,400" dur="2" begin="0"
	accelerate="1" autoReverse="true" repeatCount="5"/>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/behaviors/onmediaerror.htm

Applies To

t:ANIMATION, t:AUDIO, t:EXCL, t:IMG, t:MEDIA, t:PAR, t:REF, t:SEQ, time2, t:VIDEO

See Also

Introduction to HTML+TIME

Community Additions

© 2015 Microsoft