通过分析上海交通大学的asp网页,我们发现,object标签可以用于火狐浏览器
ASP网页地址:http://comic.sjtu.edu.cn/vlc/playAll.3.asp
下面代码为个人改编
1.ie浏览器的代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <title>CCTV 新闻</title> <link type="text/css" href="vlc.css" rel="stylesheet" /> </head> <body> <div class="plugin" id="vlcplugin"> <object type="application/x-vlc-plugin" width="720" height="576" id="video1" name="video1" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" codebase="http://comic.sjtu.edu.cn/vlc/cab/axvlc.cab" > <param name="loop" value="no" /> <param name="mrl" value="udp://@239.255.1.1:1234"> <param name="autoplay" value="true"> <param name="version" value="VideoLAN.VLCPlugin.2"> <param name="pluginspage" value="http://www.videolan.org"> <font color=white><strong>Error:</strong> Videolan插件尚未安装,请访问 <a href="http://www.videolan.org"><font color=white>www.videolan.org</font></a> 下载。请安装时务必勾选[Mozilla 插件] </font> </object> </div> </body> </html>
通过对比,火狐浏览器代码去掉了object标签中的classid和codebase属性
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"> <html> <head> <title>CCTV 新闻</title> <link type="text/css" href="vlc.css" rel="stylesheet" /> </head> <body> <div class="plugin" id="vlcplugin"> <object type="application/x-vlc-plugin" width="720" height="576" id="video1" name="video1" > <param name="loop" value="no" /> <param name="mrl" value="udp://@239.255.1.1:1234"> <param name="autoplay" value="true"> <param name="version" value="VideoLAN.VLCPlugin.2"> <param name="pluginspage" value="http://www.videolan.org"> <font color=white><strong>Error:</strong> Videolan插件尚未安装,请访问 <a href="http://www.videolan.org"><font color=white>www.videolan.org</font></a> 下载。请安装时务必勾选[Mozilla 插件] </font> </object> </div> </body> </html>
vlc.css
DIV.plugin { PADDING-BOTTOM: 0em; BACKGROUND-COLOR: #069; PADDING-LEFT: 0em; PADDING-RIGHT: 0em; FLOAT: left; PADDING-TOP: 0em }
总结:虽然这两行代码写的简单,但是在前台用js、JQuery去除属性却无法产生效果,后台用UA标签判断起来比较方便