5

I am dynamically displaying a pdf with an object tag based on its name, so there is a chance that a name is added without the pdf getting added. I would like to handle that and at least display some text rather than leaving a blank space when a pdf isn't found.

This is basically what I have:

document.getElementById("someId").innerHTML = "<object data=\"" + someName + ".pdf\" type=\"application/pdf\" width=\"500\" height=\"500\">You don't have a PDF plugin for this browser.</object>";

Is there some way I can use just use html or javascript to do something when the file doesn't load? Also, I need this to support IE7.

DeadEli
  • 983
  • 2
  • 13
  • 28

0 Answers0