HTML and CSS Reference
In-Depth Information
the attribute off. Note, however, that something interesting happens with the control UI when
scripting is disabled: in at least one browser, the control UI is added to the media element,
whether you want it or not.
Web developers wanting to provide custom controls remove the controls attribute so that
the default control doesn't conflict with the custom control. The developer typically adds the
controls attribute to the video or audio element, and then removes it using script as soon as
the media element is loaded. This form of progressiveenhancementensures that if scripting is
disabled, the user can still play the media resource.
However, sometimes people deliberately leave the controls attribute off the media element
because they're using the media element as part of a web page presentation and want the
media to play as soon as the page loads—regardless of whether scripting is enabled or not.
They'll remove the controls attribute, and add autoplay and possibly the loop attribute
(covered later in the chapter). If scripting is enabled, the default media control isn't added to
the page—but if scripting is disabled in the user's browser, according to the HTML5 specific-
ation, the browser is then supposed to add the control, by default.
This is an unusual event without precedent in web development. It's comparable to the
browser overriding CSS to display hidden or collapsed fields if scripting is disabled, regard-
less of what the developer or author wants.
Currently, Opera is the only browser that actually provides a visible control if scripting is dis-
abled. The other browsers are technically in violation of the HTML5 specification, though I
couldn't find bugs for any of the browsers asking for this behavior. There are, however, bugs
filed against the HTML5 specification to remove this unusual fallback feature. Since we don't
know if the bugs will result in a change to the specification or not, you'll want to test your use
of the HTML media elements with scripting enabled and disabled, regardless of whether you
use scripting in your page or not.
WARNING
Another browser foible: if scripting is disabled, Firefox doesn't currently display a control UI (User
Interface) even if you do provide the controls attribute. You'll need to use the right mouse button
context menu to control the media. More on this in Chapter .
Search WWH ::




Custom Search