I want to execute a script if my tag failed to load. Currently I have
<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>
But my script gets executed even the PDF plugin is available.