javascript - Why am I not getting Cross domain error? -


i have html page has iframe. ( here is)

they both @ different domains.

page a: domain = http://jsbin.com/

it hosts iframe domain : example.com

<iframe src='http://example.com' id='a'> </iframe>

however - when try access iframe content via :

$(document).ready(function ()  {   console.log($("#a").contents().find("*").length) }); 

i do see response :

enter image description here

question :

why not getting error access different origin ?

comment : seems can't access content of elements , i'm positive should have got cross domain error.

relative info : chrome version 30.0.1599.66

you don't error because frame hasn't yet loaded there isn't block. try access after loads , you'll see expected error.

$(document).ready(function (){   $("#a").load(function(){    console.log($("#a").contents().find("*").length)   }); }); 

http://jsbin.com/uqariwu/1/edit


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -