Change iframe content css from the caller page of

2019-07-23 00:04发布

问题:

Is it possible? I want an make an adaptive layout but neither CSS or JS can force the iframe content to change from the calling page. However the the iframe pages and the caller use the same CSS and JS file.

回答1:

This is only possible, if they are from the same origin. It doesn't matter if both use the same CSS or JS file. That means, both are using the same domain name, application layer protocol, and (in most browsers) port number. (Same origin policy)

If you are sure that you fullfil the above mentioned requirements, please check the following links:

  • Adding a stylesheet to an iframe
  • How to apply CSS to iFrame?
  • How to load up CSS files using Javascript?