javascript - iframe - location - same origin policy -
as believing, iframe properties (if iframe loaded origin) can not set. tried little testcases, seems can properties. doing wrong in setting example?
<iframe src="http://www.wikipedia.org" id="iframe"></iframe> <script> try { alert(document.getelementbyid("iframe").src); } catch(e) { alert(e); } </script>
the above example alerts correct location in tests.
regards
you not accessing content elements/properties of contained document. getting src
attribute of iframe
set outer document. try this:
iframeelement.contentdocument.body.style.backgroundcolor = "red";
Comments
Post a Comment