I have an iFrame that dynamically loads content when needed. THis can be in the form of text or a PDF.
I need to check if its a PDF, then hide an icon accordingly.
So far, the following code works in Chrome and Firefox:
('#iframeContentControl').load(function () {
var cssA = $('#iframeContentControl').contents().find('embed').attr("type");
if (cssA === "application/pdf") {
$("#pubIcon").hide();
} else {
$("#pubIcon").show();
}
});
Unfortunately, in IE, this doesn't work. When viewing the source, the iFrame doesn't even contain an <embed>
.
OnLoad events don't work - And I've scoured SO thoroughly for an answer, but all appear to fail.
The content loads on pageload through an .asax
handler.