1

我在 Iframe 中对内容进行样式设置时遇到问题。我无法改变这一点,我不知道为什么要这样构建,但我需要能够在 iframe 中使用 css 设置一些 div 的样式。

任何想法表示赞赏。

4

2 回答 2

1

iframe 中的内容将根据 iframe 中的 url 请求的文档中加载的 css 文件进行样式设置,而不是来自父页面的 css 文件

于 2013-07-01T20:54:52.370 回答
0

这是由于同源策略:https ://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript

出于安全原因,您不得在 iframe 中操作外部网站的代码。

于 2013-07-01T20:58:23.113 回答