1

How can i read with jquery an attr in YouTube iframe?

<iframe id="ytplayer" width="1024" height="576" frameborder="0" wmode="Opaque" allowfullscreen="" src="http://www.youtube.com/idvideo" type="text/html">
    <!DOCTYPE html>
    <html lang="de" data-cast-api-enabled="true" dir="ltr">
    .....
    .....
</iframe>

I need to know if is data-cast-api-enabled.

i have tried:

var iFrameDOM = $("iframe#ytplayer").contents();
var dataAttr = iFrameDOM.find("html").attr('data-cast-api-enabled');
alert('dataAttr')

But it does not work. I think this is a cross domain problem...

Zoran Jankov
  • 236
  • 2
  • 5
  • 18

0 Answers0