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]: update the translation of Window back() method #23113

Merged
merged 4 commits into from
Aug 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 37 additions & 9 deletions files/zh-cn/web/api/window/back/index.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
---
title: Window.back()
title: Windowback() 方法
slug: Web/API/Window/back
l10n:
sourceCommit: 44c4ec928281dc2d7c5ea42b7d2c74a2013f16ac
---

{{APIRef}}{{ Non-standard_header() }}{{deprecated_header}}

## 总结
{{domxref("window")}} 接口上过时的非标准方法 `back()` 会将窗口返回到历史记录中的前一个记录。这是 Firefox 特有的方法,已在 Firefox 31 中删除。

跳转窗口到 history 中的前一个地址,这曾是 Gecko 的方法。请使用标准的 history.back 替代它。
> [!NOTE]
> 请使用标准的 {{domxref("history.back")}} 方法。

## Syntax
## 语法

```plain
window.back()
```js-nolint
back()
```

## Example
### 参数

无。

### 返回值

无({{jsxref("undefined")}})。

## 示例

这个简单的示例通过调用 `back()` 来处理“返回”按钮的点击操作。
T34-active marked this conversation as resolved.
Show resolved Hide resolved

```js
function goBack() {
if (canGoBack) window.back();
function handleMyBackButton() {
if (canGoBack) {
window.back();
}
}
```

## 规范

不属于任何规范。

## 浏览器兼容性

这种非标准方法只在 Firefox 中实现过,并在 Firefox 31 中被删除。

## 参见

- {{domxref("History.back()")}}
- {{domxref("History.forward()")}}