1

Is there a way to get the content-type of an iframe's content inside the load event handler function attached to it?

Guillermo Gutiérrez
  • 17,273
  • 17
  • 89
  • 116

1 Answers1

2

i assume this should do the work using jquery

$('iframe').contents().contentType

in the load event this should point to the iframe dom so

$(this).contentType 

should work

KidD
  • 91
  • 7
  • Both ways returns me 'undefined'. But I know where you are going, you are getting the contentType property from the document DOM element. Why the content() method doesn't return the document DOM element? I have found an alternative way of getting the document element using raw javascript, but I would like to do it using jQuery. – Guillermo Gutiérrez Sep 20 '12 at 16:41