Back to Content

Navigator: serial property

files/en-us/web/api/navigator/serial/index.md

latest952 B
Original Source

{{APIRef("Web Serial API")}}{{SeeCompatTable}}{{SecureContext_Header}}

The serial read-only property of the {{domxref("Navigator")}} interface returns a {{domxref("Serial")}} object which represents the entry point into the Web Serial API.

When getting, the same instance of the {{domxref("Serial")}} object will always be returned.

Value

A {{domxref("Serial")}} object.

Examples

The following example uses the getPorts() method to initialize a list of available ports.

js
navigator.serial.getPorts().then((ports) => {
  // Initialize the list of available ports with `ports` on page load.
});

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also