0

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.

Community
  • 1
  • 1
TheGeekZn
  • 3,696
  • 10
  • 55
  • 91
  • possible duplicate of [Detecting onload event in IE for iFrame which has PDF](http://stackoverflow.com/questions/12741593/detecting-onload-event-in-ie-for-iframe-which-has-pdf) – Kristof Feys Dec 19 '13 at 12:20
  • @KristofFeys I've already tried that solution. Doesnt work.. – TheGeekZn Dec 19 '13 at 12:22

0 Answers0