Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zh-cn]: create translation of HTMLIFrameElement properties #19688

Merged
merged 11 commits into from
May 4, 2024
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: A1lo <[email protected]>
  • Loading branch information
T34-active and yin1999 committed May 3, 2024
commit 630c354a86ae974bb3ac9852121b7ad6b8823062
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
title: HTMLIFrameElement:allowPaymentRequest 属性
slug: Web/API/HTMLIFrameElement/allowPaymentRequest
l10n:
sourceCommit: bd162c8a824ffcc780a44b61f1b047971375624e
sourceCommit: a3d9f61a8990ba7b53bda9748d1f26a9e9810b18
T34-active marked this conversation as resolved.
Show resolved Hide resolved
---

{{APIRef("HTML DOM")}}{{Deprecated_Header}}{{Non-standard_Header}}

{{domxref("HTMLIFrameElement")}} 接口的 **`allowPaymentRequest`** 属性返回表示一个是否可以在跨源 iframe 上调用[支付请求 API](/zh-CN/docs/Web/API/Payment_Request_API) 的布尔值。
{{domxref("HTMLIFrameElement")}} 接口的 **`allowPaymentRequest`** 属性返回一个表示是否可以在跨源 iframe 上调用[支付请求 API](/zh-CN/docs/Web/API/Payment_Request_API) 的布尔值。

## 值

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ l10n:

## 值

一个布尔值,默认值为 `false`;将其设置为 `true`,将与关联的 `<iframe>` 源请求发送一个 {{httpheader("Sec-Browsing-Topics")}} 标头,其中包含当前用户选择的主题
一个布尔值,默认值为 `false`;将其设置为 `true` 可使与 `<iframe>` 相关联的源请求携带一个包含当前用户选定主题的 {{httpheader("Sec-Browsing-Topics")}} 标头。

## 示例

Expand Down Expand Up @@ -54,7 +54,7 @@ iframeElem.src = "adtech1.example";

## 规范

此功能不是正式标准的一部分,尽管它在 [Topics API 非官方建议草案](https://patcg-individual-drafts.github.io/topics/)中有规定
此特性不属于官方标准,尽管它被定义在 [Topics API 非官方建议草案](https://patcg-individual-drafts.github.io/topics/)

## 浏览器兼容性

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ l10n:

如果 iframe 及其父文档处于[同源](/zh-CN/docs/Web/Security/Same-origin_policy),则返回一个 [`Document`](/zh-CN/docs/Web/API/Document)(即嵌套浏览上下文中的活动文档),否则返回 `null`。

## 内容文档示例
## contentDocument 示例

```js
const iframeDocument = document.querySelector("iframe").contentDocument;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ iframe.document.querySelector("body").style.backgroundColor = "blue";
// 这将使文档中的第一个 iframe 变成蓝色。
```

### 将信息源映射到 iframe
### 将消息源映射到 iframe

此示例可在包含多个 iframe 的页面中运行,其中任何一个都可以使用 {{domxref("Window.postMessage()")}} 发送信息。当页面接收到消息时,就会知道哪个 iframe 包含发送消息的窗口。

为了做到这一点,当接收到消息时,页面首先检查消息来自预期的源,然后通过比较消息事件的 {{domxref("MessageEvent.source", "source")}} 属性和 iframe 的 `contentWindow` 属性来找到 iframe 消息来源
为了做到这一点,当接收到消息时,页面首先检查消息是否来自预期的源,然后通过比较消息事件的 {{domxref("MessageEvent.source", "source")}} 属性和 iframe 的 `contentWindow` 属性来找到消息来自哪个 iframe。

```js
const expectedOrigin = "https://example.org";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ l10n:

{{APIRef("Feature Policy API")}}{{SeeCompatTable}}

{{DOMxRef("HTMLIFrameElement")}} 接口的 **`featurePolicy`** 只读属性返回一个简单的 API 用于检查应用到特定 iframe [权限策略](/zh-CN/docs/Web/HTTP/Permissions_Policy) 的 {{DOMxRef("FeaturePolicy")}} 接口
{{DOMxRef("HTMLIFrameElement")}} 接口的 **`featurePolicy`** 只读属性返回 {{DOMxRef("FeaturePolicy")}} 接口。该接口提供一个简单的 API,用于检查应用于特定的 iframe [权限策略](/zh-CN/docs/Web/HTTP/Permissions_Policy)。

## 值

Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/htmliframeelement/height/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ l10n:

{{APIRef("HTML DOM")}}

{{domxref("HTMLIFrameElement")}} 接口的 **`height`** 属性返回一个 {{HTMLElement("iframe")}} 元素的 `height` 属性的字符串,表示 iframe 的 CSS 像素高度。
{{domxref("HTMLIFrameElement")}} 接口的 **`height`** 属性返回一个反映 {{HTMLElement("iframe")}} 元素的 `height` 属性的字符串,表示 iframe 的 CSS 像素高度。

## 值

Expand All @@ -21,7 +21,7 @@ l10n:

```js
const el = document.getElementById("el");
console.log(el.height); // 输出:'600'
console.log(el.height); // 输出:600
```

## 规范
Expand Down
6 changes: 3 additions & 3 deletions files/zh-cn/web/api/htmliframeelement/loading/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ l10n:

{{domxref("HTMLIFrameElement")}} 接口的 **`loading`** 属性为{{Glossary("user agent", "用户代理")}}提供一个提示字符串,表示是否应在页面加载时立即加载 [iframe](/zh-CN/docs/Web/HTML/Element/iframe),或者仅在需要时才加载。

这可用于优化文档内容的加载。在页面加载时可见的 iframe 可以立即(急切地)下载,而可能在初始页面加载时位于屏幕外的 iframe 可以懒加载——在它们出现在窗口的{{Glossary("visual viewport", "可视化视口")}}之前执行
这可用于优化文档内容的加载。在页面加载时可见的 iframe 可以立即(即时)下载,而可能在初始页面加载时位于屏幕外的 iframe 可以懒加载——它们仅在将要出现在窗口的{{Glossary("visual viewport", "可视视口")}}中时下载

## 值

Expand All @@ -26,13 +26,13 @@ l10n:

只有启用 JavaScript 时才会延迟加载,与属性的值无关。

这是一种反跟踪措施,因为如果用户代理在禁用脚本的情况下支持懒加载,网站仍然可以通过在页面标记中战略性地放置 iframe 来跟踪用户会话中的大致滚动位置,以便服务器可以跟踪请求多个 iframe 以及何时请求
这是一种反跟踪措施,因为如果用户代理在禁用脚本的情况下支持懒加载,网站仍能通过在页面标记中策略性地放置 iframe 来跟踪用户会话中的大致滚动位置,服务器能够根据请求 iframe 数量和时间来判断用户的浏览进度
yin1999 marked this conversation as resolved.
Show resolved Hide resolved

### 加载事件的时间

当文档已被完全处理时,将触发 {{domxref("Window.load_event", "load")}} 事件。

即使 iframe 位于可视视口并在页面加载时被请求,懒加载的 iframe 也不会影响 `load` 事件的时机。只有当文档中所有急切加载的 iframe 都被请求后,才能触发 `load` 事件。
即使 iframe 位于可视视口并在页面加载时被请求,懒加载的 iframe 也不会影响 `load` 事件的时机。只有当文档中所有立即加载的 iframe 都被请求后,才能触发 `load` 事件。

## 示例

Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/api/htmliframeelement/name/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ l10n:

{{APIRef("HTML DOM")}}

{{domxref("HTMLIFrameElement")}} 接口的 **`name`** 表示 {{HTMLElement("iframe")}} 元素的 `name` 属性的字符串值,`<iframe>` 元素为特定名称
{{domxref("HTMLIFrameElement")}} 接口的 **`name`** 属性是字符串值,表示 {{HTMLElement("iframe")}} 元素的 `name` 属性为 `<iframe>` 元素特定名称
yin1999 marked this conversation as resolved.
Show resolved Hide resolved

## 值

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ l10n:

{{APIRef}}

**`HTMLIFrameElement.referrerPolicy`** 属性表示 {{HTMLElement("iframe")}} 元素定义在获取资源时发送哪个引用者时的 HTML [`referrerpolicy`](/zh-CN/docs/Web/HTML/Element/iframe#referrerpolicy) 属性定义在获取资源时发送哪个引用者时的 HTML
**`HTMLIFrameElement.referrerPolicy`** 属性表示了 {{HTMLElement("iframe")}} 元素的 [`referrerpolicy`](/zh-CN/docs/Web/HTML/Element/iframe#referrerpolicy) 属性,该属性定义了在获取资源时发送哪个引用者

## 值

- `no-referrer`
- : {{HTTPHeader("Referer")}} 标头将被完全省略。请求时不会发送任何引用者信息。
- `no-referrer-when-downgrade`
- : 当协议安全级别保持不变(HTTP → HTTPHTTPS → HTTPS)时,URL 作为引用者发送,但不会发送到安全性较低的目的地(HTTPS → HTTP)。
- : 当协议安全级别保持不变(HTTP → HTTPHTTPS → HTTPS)时,URL 作为引用者发送,但不会发送到安全性较低的目的地(HTTPS → HTTP)。
- `origin`
- : 在所有情况下仅发送文档的源作为引用者。`https://example.com/page.html` 文档将发送引用者 `https://example.com/` 。
- `origin-when-cross-origin`
Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/api/htmliframeelement/sandbox/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ l10n:

{{APIRef("HTML DOM")}}

{{domxref("HTMLIFrameElement")}} 接口的 **`sandbox`** 只读属性表示返回 {{domxref("DOMTokenList")}} 表示对嵌套内容行为的限制
{{domxref("HTMLIFrameElement")}} 接口的 **`sandbox`** 只读属性返回表示对嵌套内容行为的限制的 {{domxref("DOMTokenList")}}。

它表示 {{HTMLElement("iframe")}} 元素的 `sandbox` 属性。

Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/api/htmliframeelement/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ l10n:

**`HTMLIFrameElement.src`** 是一个反映包含要嵌入内容地址的 [`src`](/zh-CN/docs/Web/HTML/Element/iframe#src) HTML 属性的字符串。

请注意,通过 {{domxref("Element.removeAttribute()")}} 等方法从 `<iframe>` 中程序性移除 `src` 属性会在 iframe 中加载 `about:blank`。
请注意,以编程的方式,通过 {{domxref("Element.removeAttribute()")}} 等方法从 `<iframe>` 中移除 `src` 属性会导致 iframe 加载 `about:blank`。

## 语法

Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/api/htmliframeelement/width/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ l10n:

{{APIRef("HTML DOM")}}

{{domxref("HTMLIFrameElement")}} 接口的 **`width`** 属性返回一个 {{HTMLElement("iframe")}} 元素的 `width` 属性的字符串,表示 iframe 的 CSS 像素宽度。
{{domxref("HTMLIFrameElement")}} 接口的 **`width`** 属性返回一个反映 {{HTMLElement("iframe")}} 元素的 `width` 属性的字符串,表示 iframe 的 CSS 像素宽度。

## 值

Expand All @@ -21,7 +21,7 @@ l10n:

```js
const el = document.getElementById("el");
console.log(el.width); // 输出:'800'
console.log(el.width); // 输出:800
```

## 规范
Expand Down