Skip to content

Commit

Permalink
NavigationHistoryEntry | add info for return value or value (#31438)
Browse files Browse the repository at this point in the history
* update NavigationHistoryEntry.url

* style pretty

* update text

* add info for not fully active document

* update desc

* revert

* update text

* fix text
  • Loading branch information
skyclouds2001 committed Dec 31, 2023
1 parent df3316c commit 49bd8d2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 15 deletions.
5 changes: 2 additions & 3 deletions files/en-us/web/api/navigationhistoryentry/getstate/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.NavigationHistoryEntry.getState

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`getState()`** method of the
{{domxref("NavigationHistoryEntry")}} interface returns a clone of the developer-supplied state associated with this history entry.
The **`getState()`** method of the {{domxref("NavigationHistoryEntry")}} interface returns a clone of the developer-supplied state associated with this history entry.

## Syntax

Expand All @@ -27,7 +26,7 @@ None.

A value representing the state. This can be any [structured-cloneable](/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) data type.

If no state is defined, it returns `undefined`.
If no state is defined or if current document is not fully active, it returns `undefined`.

### Exceptions

Expand Down
3 changes: 1 addition & 2 deletions files/en-us/web/api/navigationhistoryentry/id/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.NavigationHistoryEntry.id

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`id`** read-only property of the
{{domxref("NavigationHistoryEntry")}} interface returns the `id` of the history entry. This is a unique, UA-generated value that always represents a specific history entry, useful to correlate it with an external resource such as a storage cache.
The **`id`** read-only property of the {{domxref("NavigationHistoryEntry")}} interface returns the `id` of the history entry, or an empty string if current document is not fully active. This is a unique, UA-generated value that always represents a specific history entry, useful to correlate it with an external resource such as a storage cache.

This differs from the {{domxref("NavigationHistoryEntry.key", "key")}} of a history entry. The `key` is a unique, UA-generated value that represents the history entry's slot in the entries list rather than the entry itself. It is used to navigate that particular slot via {{domxref("Navigation.traverseTo()")}}. The `key` will be reused by other entries that replace the entry in the list (that is, if the {{domxref("NavigateEvent.navigationType")}} is `replace`).

Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/navigationhistoryentry/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _Inherits properties from its parent, {{DOMxRef("EventTarget")}}._
- {{domxref("NavigationHistoryEntry.sameDocument", "sameDocument")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns `true` if this history entry is for the same `document` as the current {{domxref("Document")}} value, or `false` otherwise.
- {{domxref("NavigationHistoryEntry.url", "url")}} {{ReadOnlyInline}} {{Experimental_Inline}}
- : Returns the absolute URL of this history entry.
- : Returns the absolute URL of this history entry. If the entry corresponds to a different document than the current one (like `sameDocument` property is `false`), and that document was fetched with a {{httpheader("Referrer-Policy", "referrer policy")}} header set to `no-referrer` or `origin`, the property returns `null`.

## Instance methods

Expand Down
3 changes: 1 addition & 2 deletions files/en-us/web/api/navigationhistoryentry/index/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.NavigationHistoryEntry.index

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`index`** read-only property of the
{{domxref("NavigationHistoryEntry")}} interface returns the index of the history entry in the history entries list (that is, the list returned by {{domxref("Navigation.entries()")}}), or `-1` if the entry does not appear in the list.
The **`index`** read-only property of the {{domxref("NavigationHistoryEntry")}} interface returns the index of the history entry in the history entries list (that is, the list returned by {{domxref("Navigation.entries()")}}), or `-1` if the entry does not appear in the list or if current document is not fully active.

## Value

Expand Down
3 changes: 1 addition & 2 deletions files/en-us/web/api/navigationhistoryentry/key/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.NavigationHistoryEntry.key

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`key`** read-only property of the
{{domxref("NavigationHistoryEntry")}} interface returns the `key` of the history entry. This is a unique, UA-generated value that represents the history entry's slot in the entries list. It is used to navigate that particular slot via {{domxref("Navigation.traverseTo()")}}. The `key` will be reused by other entries that replace the entry in the list (that is, if the {{domxref("NavigateEvent.navigationType")}} is `replace`).
The **`key`** read-only property of the {{domxref("NavigationHistoryEntry")}} interface returns the `key` of the history entry, or an empty string if current document is not fully active. This is a unique, UA-generated value that represents the history entry's slot in the entries list. It is used to navigate that particular slot via {{domxref("Navigation.traverseTo()")}}. The `key` will be reused by other entries that replace the entry in the list (that is, if the {{domxref("NavigateEvent.navigationType")}} is `replace`).

This differs from the {{domxref("NavigationHistoryEntry.id", "id")}} of a history entry. The `id` is a unique, UA-generated value that always represents a specific history entry rather than its slot in the entries list. This is useful to correlate it with an external resource such as a storage cache.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ browser-compat: api.NavigationHistoryEntry.sameDocument

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`sameDocument`** read-only property of the
{{domxref("NavigationHistoryEntry")}} interface returns `true` if this history entry is for the same `document` as the current {{domxref("Document")}} value, or `false` otherwise.
The **`sameDocument`** read-only property of the {{domxref("NavigationHistoryEntry")}} interface returns `true` if this history entry is for the same `document` as the current {{domxref("Document")}} value and current document is fully active, or `false` otherwise.

## Value

Expand Down
5 changes: 2 additions & 3 deletions files/en-us/web/api/navigationhistoryentry/url/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ browser-compat: api.NavigationHistoryEntry.url

{{APIRef("Navigation API")}}{{SeeCompatTable}}

The **`url`** read-only property of the
{{domxref("NavigationHistoryEntry")}} interface returns the absolute URL of this history entry.
The **`url`** read-only property of the {{domxref("NavigationHistoryEntry")}} interface returns the absolute URL of this history entry. If the entry corresponds to a different Document than the current one (like `sameDocument` property is `false`), and that Document was fetched with a {{httpheader("Referrer-Policy", "referrer policy")}} header set to `no-referrer` or `origin`, the property returns `null`. If current document is not fully active, it returns an empty string.

## Value

A string representing the URL.
A string representing the URL or `null`.

## Examples

Expand Down

0 comments on commit 49bd8d2

Please sign in to comment.