1

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.

Alex
  • 32,506
  • 16
  • 106
  • 171

2 Answers2

1

You can detect if the browser hat the adobe reader plugin installed:

javascript detect adobe reader plugin for browser

Community
  • 1
  • 1
PiTheNumber
  • 22,828
  • 17
  • 107
  • 180
0

PDFObject might be a solution.

Alex
  • 32,506
  • 16
  • 106
  • 171