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 :
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) }); });
Comments
Post a Comment