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

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -