只有当用户浏览器是 Safari 时,我才想使用 html5 视频标签,如果不是,请使用 Flash 视频播放器。
下面的代码不起作用(<!--[if Safari]>
条件无效),但它可能会让您了解我在寻找什么
<!--[if Safari]>
<video id="player" width="480" controls>
<source src="path/to/movie.mov" />
</video>
<![endif]-->
<!--[if !Safari]>
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {
allowscriptaccess: "true",
file:"path/to/movie.mov"
};
var attributes = {};
swfobject.embedSWF("swf/player.swf", "player", "640", "480", "9.0.0", flashvars, params, attributes);
</script>
<![endif]-->