2

I have a iframe embeded in my page. I saw an paper icon with sad face in it.

enter image description here

I inspect it, it has an id #sub-frame-error-details


iFrame

<iframe id="iframe-rm" name="my-iframe" src="https://192.237.175.25:555/" width="100%" height="800px" class=""></iframe>

Try #1

console.log($('#sub-frame-error-details').length);

I kept getting 0.


Try #2

document.getElementById("sub-frame-error-details")

I got null


Try #3

var obj = $("#iframe-rm").contents().find("#main-frame-error");

console.log(obj.length);

still get 0 print out.

How do I detect if it's there ?

halfer
  • 19,824
  • 17
  • 99
  • 186
code-8
  • 54,650
  • 106
  • 352
  • 604
  • Try this: http://stackoverflow.com/questions/1796619/how-to-access-the-content-of-an-iframe-with-jquery – Webomatik May 16 '16 at 18:52
  • I tried `var obj = $("#iframe-rm").contents().find("#main-frame-error"); console.log(obj.length);` , and I still getting `0` - while knowing for sure that it is there. – code-8 May 16 '16 at 18:59
  • Are the contents of the iframe cross-domain? If so, you can't access their contents and it will give you either a 0 or a null return depending on the way you try to access it. – JoeL May 16 '16 at 19:28
  • Expanding on Joe's comment is this: http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe – Shakespeare May 16 '16 at 19:29
  • Yes, they're cross domain. So how would go above and detect something like that ? Is it impossible ? Please advise. – code-8 May 16 '16 at 19:29

0 Answers0