Skip to content

Commit

Permalink
[zh-cn]: create the translation of browserSettings.newTabPosition p…
Browse files Browse the repository at this point in the history
…roperty (#21235)

Co-authored-by: A1lo <[email protected]>
  • Loading branch information
tianyeeT and yin1999 authored Jun 3, 2024
1 parent a73c768 commit f58052b
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: browserSettings.newTabPosition
slug: Mozilla/Add-ons/WebExtensions/API/browserSettings/newTabPosition
l10n:
sourceCommit: 43e3ff826b7b755b05986c99ada75635c01c187c
---

{{AddonSidebar}}

一个 {{WebExtAPIRef("types.BrowserSetting", "BrowserSetting")}} 对象,可用于控制新打开标签页相对于已打开标签页的位置。

其底层值是一个字符串,可以取三个值中的一个:

- “afterCurrent”:在当前标签页旁边打开所有新标签页。
- “relatedAfterCurrent”:默认值。如果新标签页与当前标签页相关联(例如,通过当前标签页中的链接打开),则在当前标签页旁边打开新标签页。否则,在标签栏的末尾打开新标签页。
- “atEnd”:在标签栏的末尾打开所有新标签页。

## 浏览器兼容性

{{Compat}}

## 示例

以下代码将值设置为“afterCurrent”,然后记录新值:

```js
async function setAfterCurrent() {
let result = await browser.browserSettings.newTabPosition.set({
value: "afterCurrent",
});
console.log(`结果:${result}`);
let newValue = await browser.browserSettings.newTabPosition.get({});
console.log(`新值:${newValue.value}`);
}
```

{{WebExtExamples}}

0 comments on commit f58052b

Please sign in to comment.