大网数据广告活动
Web 标准与前端开发

<meta name="responsive-embedded-sizing">

· 52CE 我爱测

The **`responsive-embedded-sizing`** value for the `name` attribute of a meta element opts in a document embedded in an iframe to sharing its size information with the parent document. The frame can then be sized relative to its contained document's layout size using the frame-si

The responsive-embedded-sizing value for the name attribute of a meta element opts in a document embedded in an iframe to sharing its size information with the parent document. The frame can then be sized relative to its contained document's layout size using the frame-sizing CSS property.

Description

For security and privacy reasons, iframe elements do not by default expose any information to the parent document about the size of the content in the document they are embedding.

To enable responsive sizing of iframe elements based on their content, the <meta name="responsive-embedded-sizing"> tag can be included in an embedded document to opt it in to sharing its size information with the parent document.

The frame-sizing CSS property can then be set on the <iframe> to cause it to adopt the same horizontal or vertical size as the embedded document's actual content size (termed the internal layout intrinsic size in the spec, but abbreviated to "layout size" in our documentation). This allows <iframe> content to fit seamlessly into the embedding element and avoid unnecessary scrollbars.

To resize the <iframe> dynamically as the embedded document changes layout size, you can call the Window.requestResize() method from the embedded document to make it report an updated size.

Examples

See the frame-sizing and Window.requestResize() pages for complete examples.

Specifications

Browser compatibility

See also

  • Window.requestResize()
  • frame-sizing CSS property
  • CSS box sizing module

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。