Back to Content

NavigationDestination: sameDocument property

files/en-us/web/api/navigationdestination/samedocument/index.md

latest790 B
Original Source

{{APIRef("Navigation API")}}

The sameDocument read-only property of the {{domxref("NavigationDestination")}} interface returns true if the navigation is to the same document as the current {{domxref("Document")}} value, or false otherwise.

This is useful for checking whether the navigation will be same-document or cross-document.

Value

A boolean.

Examples

js
navigation.addEventListener("navigate", (event) => {
  console.log(event.destination.sameDocument);
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also