Krishna
Krishna

Reputation: 1540

Apply style on Iframe from cross domain

I have a widget which is loading by iframe. Can I change style for inner content ?

I used Following plugin to try : https://github.com/davidjbradshaw/iframe-resizer/tree/master/example

jQuery('#market_quotes_f').iFrameResize({
    log : true,                  // Enable console logging
    autoResize: false,
    enablePublicMethods: true,
    sizeWidth: true     
});

Thanks in advance..

Upvotes: 1

Views: 1336

Answers (1)

David Bradshaw
David Bradshaw

Reputation: 13097

You can only change the styles in the iFrame, from the parent page, if both are hosted on the same domain. Or you control both domains.

The iframe-resizer script you are using requires that you place JS files on both the host page and the child page in the iFrame. If you have done this then why not just add a CSS file to the iframe content?

Upvotes: 1

Related Questions