-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[zh-cn]: update the translation of Window
back()
method (#23113)
Co-authored-by: A1lo <[email protected]>
- Loading branch information
1 parent
b0cd495
commit 6a1f613
Showing
1 changed file
with
37 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,52 @@ | ||
--- | ||
title: Window.back() | ||
title: Window:back() 方法 | ||
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()` 来处理“返回”按钮的点击操作。 | ||
|
||
```js | ||
function goBack() { | ||
if (canGoBack) window.back(); | ||
function handleMyBackButton() { | ||
if (canGoBack) { | ||
window.back(); | ||
} | ||
} | ||
``` | ||
|
||
## 规范 | ||
|
||
不属于任何规范。 | ||
|
||
## 浏览器兼容性 | ||
|
||
这种非标准方法只在 Firefox 中实现过,并在 Firefox 31 中被删除。 | ||
|
||
## 参见 | ||
|
||
- {{domxref("History.back()")}} | ||
- {{domxref("History.forward()")}} |