问题
I've been trying to find a definitive modern source for the state of the art in how to embed audio, and been finding lots of up to date info on flash video, and lots of really old and questionable articles on audio embedding (e.g. with references to IE 3.0). Also haven't been able to find anything here on stackoverflow, or on doctype.
I'm writing in html4, so obviously though the html5 audio tag would be great, it's not a solution for me.
So how should audio be embedded for maximizing features and browser support?
The specific file that I'm working with is a midi type, though I don't expect that's overly important.
回答1:
In HTML4, the best thing would probably be an <object>
, since <embed>
was deprecated in that version. See e.g. Generic inclusion: the object element in the HTML4 specs. Something like this would suffice:
<object data="/path/to/audio.midi" type="audio/midi">
<p>Fall-back text for browsers that can't handle the MIDI file.</p>
</object>
来源:https://stackoverflow.com/questions/3464101/what-is-the-state-of-the-art-for-embedding-audio-in-html4