javascript - Modifying width and height of a div element inside an iframe - cross domain policy -


i have domain , subdomain. domain under control, subdomain pointed affiliate whitelabel website, i.e. dns points ip. want load products through iframes on domain.

i understand cannot use javascript change styling due cross domain policy. want accomplish modify height , width of div deep inside iframe.

using php simple load content not working, because page heavily scripted, , if doing that, framework of page appears, yet no content available.

please point me practical solution? know jquery enough able replace, add styling things on same domain, iframe or not iframe. have no idea how on subdomain. can control subdomain, ie can change dns want, stop whitelabel site working. can't add headers.

the postmessage function should here, provided can put own javascript code on both domains.

https://developer.mozilla.org/en-us/docs/web/api/window/postmessage

something should work:

parent

var iframe = document.getelementbyid("whatever"); iframe.contentwindow.postmessage("hello"); 

iframe

window.addeventlistener("message", receivemessage, false);  function receivemessage(event) {     if (event.origin !== "http://your-parent-domain.com") return; // security      // here event.data } 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -