Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SharedWorker.port

This article needs a technical review. How you can help.

The port property of the SharedWorker interface returns a MessagePort object used to communicate and control the shared worker.

Syntax

myWorker.port;

Value

A MessagePort object.

Example

The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor. Multiple scripts can then access the worker through a MessagePort object accessed using the SharedWorker.port property — the port is started using its start() method:

var myWorker = new SharedWorker("worker.js");
myWorker.port.start();

For a full example, see our Basic shared worker example (run shared worker.)

Specifications

Specification Status Comment
WHATWG HTML Living Standard
The definition of 'AbstractWorker.onerror' in that specification.
Living Standard No change from Web Workers.
Web Workers
The definition of 'AbstractWorker.onerror' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Support 4 29.0 (29.0) Not supported 10.60 5
Not supported 6.1
Feature Android Chrome for Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Mobile Opera Mobile Safari Mobile
Support Not supported Not supported 33.0 (33.0) 2.1 Not supported 11.5 5.1
Not supported 7.1

See also

Document Tags and Contributors

 Contributors to this page: Sebastianz, julienw, fscholz, chrisdavidmills, kscarfone
 Last updated by: Sebastianz,