执行脚本如果插件<对象>无法加载标签
Execute script if plugin for <object> tag could not be loaded
如果我的标签加载失败,我想执行一个脚本。现在我有
<object src="http://foo.com/bar.pdf#navpanes=0" height="580" width="640">
<a href="http://foo.com/bar.pdf">Click here to download the PDF</a>
<script type="text/javascript">
//<![CDATA[
window.alert('script executed');
window.location.href = "http://foo.com/bar.pdf";
//]]>
</script>
</object>
但是即使PDF插件可用,我的脚本也会执行。
可以检测浏览器是否安装了adobereader插件:
PDFObject可能是一个解决方案。