shared worker safari

Safari now fully supports SharedWorkers

Multi window apps have become a reality using webkit.

Tobias Uhlig

Tobias Uhlig

I am super excited about this feature, since I have literally been waiting for it for over two years now. We can now easily create multi screen apps, as well as sharing API related data across multiple browser tabs.

  • Introduction
  • How to install the Safari Tech Preview?
  • How to create a SharedWorker based on a JS module?
  • The neo.mjs multi window Covid Dashboard
  • The current state of browsers
  • Final thoughts

1. Introduction

For those of you who are not familiar with SharedWorkers yet, take a quick look at this link:

SharedWorker - Web APIs | MDN

The sharedworker interface represents a specific kind of worker that can be accessed from several browsing contexts….

developer.mozilla.org

While Chrome and Firefox do support SharedWorkers for quite some time, the story is very different for the Webkit based scope.

The team actually worked on an implementation many years ago, but if I remember it correctly dropped the development at version 7 because of security concerns.

I was involved in a quite big community effort to push the feature back into the “on radar” category:

149850 - Reinstate support for SharedWorkers

Bug 149850: reinstate support for sharedworkers.

bugs.webkit.org

Fast forward: the Webkit team created a new ticket and resolved this one almost in secret:

230382 - Implement SharedWorker

Edit description.

This ticket is resolved now and it just ended up inside the latest version of the Safari Tech Preview:

2. How to install the Safari Tech Preview?

The installation is easy:

Resources - Safari - Apple Developer

Tools, documentation, forums, videos, and more. videos watch and learn from our engineers as they show how to bring the….

developer.apple.com

3. How to create a SharedWorker based on a JS module?

You can create a non module based worker like this:

In case you do want a JS module as the starting point, just use the type option:

4. The neo.mjs multi window Covid Dashboard

This demo app is still one of the most amazing neo.mjs demos:

So far, it did only run inside Chromium and Firefox browsers. Now, it does also run inside Safari Tech Preview :)

Try it out for yourself:

development mode (Chromium, Safari): neo.mjs/apps/sharedcovid/index.html#mainview=table

dist/production (Chromium, Firefox, Safari): neo.mjs/dist/production/apps/sharedcovid/index.html#mainview=table

5. Current state of browsers

We can summarise it as follows:

( generated with https://imgflip.com/memegenerator/187760713/Three-dragons )

Safari made a huge comeback when it comes to rendering performance. E.g. the neo.mjs helix and gallery views are at the same level as Chromium. Firefox feels around 10x slower in this scenario and this is really intense.

While Firefox does support SharedWorkers as well, the Mozilla team has not finished the support for JS modules inside the worker based scope yet. More precisely: dynamic imports are not working yet.

For the neo.mjs scope this means:

dev mode (dedicated workers): Chromium, Safari

dev mode (shared workers): Chromium, Safari

dist/production (dedicated workers): Chromium, Firefox, Safari

dist/production (shared workers): Chromium, Firefox, Safari

It would be very nice to see Mozilla catching up again soon!

6. Final thoughts

At this point, the neo.mjs workers setup runs right away inside Safari:

This is also true in case we switch to the SharedWorkers scope.

This enables us to directly communicate across multiple browser windows and share the same backend (API) data, which results in less calls to the BE.

The performance gains are stunning.

Thinking about iOS: Apple still restricts iOS to only allow the Webkit Engine. Meaning: Chrome on iOS is just a skinned Safari. As soon as the SW support ends up on iOS too, we can create hybrid apps which use headless browsers and in there, apps can also directly communicate.

The new Safari release pushes neo.mjs to its prime time. Unless you want to become the next jQuery developer of tomorrow, I can only strongly recommend to take a deep dive into it:

GitHub - neomjs/neo: The application worker driven frontend framework

Neo.mjs enables you to create scalable & high performant apps using more than just one cpu. no need to take care of a….

In case you need help with learning neo, you are very welcome to join the Slack channel:

join.slack.com

Best regards & happy coding, Tobias

Tobias Uhlig

Written by Tobias Uhlig

More from tobias uhlig and itnext.

Web-Based Multi-Screen Apps Including Drag & Drop

Geek Culture

Web-Based Multi-Screen Apps Including Drag & Drop

I am excited about this topic, since the technology we are going to talk about opens the way for a new generation of web based apps, which….

Benchmark results of Kubernetes network plugins (CNI) over 40Gbit/s network [2024]

Alexis Ducastel

Benchmark results of Kubernetes network plugins (CNI) over 40Gbit/s network [2024]

This article is a new run of my previous benchmark (2020, 2019 and 2018), now running kubernetes 1.26 and ubuntu 22.04 with cni version….

Frontend Development Beyond React: Svelte (1/3)

Héla Ben Khalfallah

Frontend Development Beyond React: Svelte (1/3)

Delving into svelte, solid, and qwik.

Expanding Single Page Apps into multiple Browser Windows

The Startup

Expanding Single Page Apps into multiple Browser Windows

Recommended from medium.

Progressive enhancement and JavaScript frameworks — a complicated relationship

Richard Bultitude

Progressive enhancement and JavaScript frameworks — a complicated relationship

There’s long been an incompatibility between progressive enhancement (pe) and front-end javascript frameworks, making it a real challenge….

Breaking Down Barriers: Easy Web Components with Lit

Breaking Down Barriers: Easy Web Components with Lit

Exploring web components: a guide to easy development with libraries, focusing on lit’s unique approach.

shared worker safari

General Coding Knowledge

shared worker safari

Stories to Help You Grow as a Software Developer

shared worker safari

Coding & Development

An illustration of two women standing in front of a climbing wall, having a discussion about the climb they are about to do.

Julien Etienne

Stop Using localStorage

Bid farewell to localstorage embrace indexeddb for speed, type-safe storage, and non-blocking data transactions. #indexeddb #webdev.

I Built an App in 6 Hours that Makes $1,500/Mo

Artturi Jalli

I Built an App in 6 Hours that Makes $1,500/Mo

Copy my strategy.

Advice From a Software Engineer With 8 Years of Experience

Benoit Ruiz

Better Programming

Advice From a Software Engineer With 8 Years of Experience

Practical tips for those who want to advance in their careers.

Apple’s all new design language

Ameer Omidvar

Apple’s all new design language

My name is ameer, currently the designer of sigma. i’ve been in love with design since i was a kid. it was just my thing. to make things….

Text to speech

Craig Buckler

How to Use JavaScript Shared Web Workers in HTML5

Share this article

Web Workers in a Nutshell

Creating a shared web worker, communicating with a shared web worker, frequently asked questions (faqs) about javascript shared web workers.

We recently discussed JavaScript web workers with reference to the “dedicated” variety. If you’ve not read it yet, I suggest you do that first — this article builds on the same concepts.

  • DOM2 events (addEventListener) handlers appear to be the most reliable implementation.
  • You’ll almost certainly encounter browser-specific quirks and debugging is difficult. The following code works in the latest version of Chrome, but don’t assume it’ll work in Safari or Opera.
  • load further scripts with importScripts()
  • attach error handlers, and
  • run the port.close() method to prevent further communication on a specific port.

What is the main difference between Shared Workers and Web Workers in JavaScript?

Shared Workers and Web Workers in JavaScript both allow for multi-threading, but they differ in their scope and usage. A Web Worker is limited to the scope of the tab in which it was created. It cannot communicate with other tabs or windows. On the other hand, a Shared Worker can be accessed from multiple scripts — even those being run on different tabs, windows, or iframes, as long as they are in the same domain. This makes Shared Workers ideal for tasks that require data sharing and communication between different browser contexts.

How do I create a Shared Worker in JavaScript?

Creating a Shared Worker in JavaScript involves instantiating the SharedWorker object. Here’s a simple example: var mySharedWorker = new SharedWorker('worker.js'); In this example, ‘worker.js’ is the script that the Shared Worker will execute. It’s important to note that the script must be on the same domain as the script creating the Shared Worker due to same-origin policy restrictions.

How can I communicate with a Shared Worker?

Communication with a Shared Worker is done using the postMessage method and the onmessage event handler. The postMessage method is used to send messages to the Shared Worker, while the onmessage event handler is used to receive messages from it. Here’s an example: // Sending a message to the Shared Worker mySharedWorker.port.postMessage('Hello, worker!'); // Receiving a message from the Shared Worker mySharedWorker.port.onmessage = function(e) { console.log('Message received from worker: ' + e.data); };

Can Shared Workers share data between different browser tabs?

Yes, one of the key features of Shared Workers is their ability to share data between different browser tabs, windows, or iframes. This is possible because all scripts from the same domain have access to the same Shared Worker instance. This makes Shared Workers ideal for tasks that require real-time updates across multiple tabs or windows, such as collaborative editing apps or multi-tab games.

Are Shared Workers supported in all browsers?

As of now, Shared Workers are supported in most modern browsers, including Google Chrome, Firefox, and Safari. However, they are not supported in Internet Explorer. It’s always a good idea to check the latest browser compatibility information on websites like Can I Use or MDN Web Docs.

How can I handle errors in Shared Workers?

Shared Workers have an ‘onerror’ event handler that can be used to catch and handle any errors that occur during their execution. Here’s an example: mySharedWorker.onerror = function(e) { console.log('An error occurred: ' + e.message); };

Can Shared Workers make AJAX requests?

Yes, Shared Workers can make AJAX requests. They have access to the XMLHttpRequest object, which can be used to make asynchronous requests to a server. This allows Shared Workers to fetch data from a server without blocking the main thread, improving the performance of your web application.

Can Shared Workers use WebSockets?

Yes, Shared Workers can use WebSockets. This allows them to establish a two-way communication channel with a server, making it possible to send and receive data in real-time without the need for polling.

Can Shared Workers access the DOM?

No, Shared Workers cannot directly access the DOM. This is because they run in a separate thread and do not have access to the same scope as the main thread. However, they can send messages to the main thread, which can then update the DOM based on these messages.

How can I terminate a Shared Worker?

Shared Workers can be terminated by calling the ‘terminate’ method on the SharedWorker object. However, it’s important to note that this will immediately terminate the Shared Worker, regardless of whether it has finished its current task. Here’s an example: mySharedWorker.terminate(); This will immediately terminate the Shared Worker. It’s generally a good idea to only terminate a Shared Worker if it’s no longer needed or if it’s causing performance issues.

Craig is a freelance UK web consultant who built his first page for IE2.0 in 1995. Since that time he's been advocating standards, accessibility, and best-practice HTML5 techniques. He's created enterprise specifications, websites and online applications for companies and organisations including the UK Parliament, the European Parliament, the Department of Energy & Climate Change, Microsoft, and more. He's written more than 1,000 articles for SitePoint and you can find him @craigbuckler .

SitePoint Premium

WebKit Features in Safari 16 Beta">News from WWDC22: WebKit Features in Safari 16 Beta

Jun 6, 2022

by Jen Simmons

Web Inspector Extensions

Container queries, web push for macos, flexbox inspector, accessibility improvements, animation improvements, overscroll behavior, shared worker.

WebKit has had a big year, with over 162 new features and improvements shipping in WebKit browsers — including Safari 15.2 , Safari 15.4 , and Safari 15.5 . Features from earlier this year include dialog element , lazy loading, inert, :has() pseudo-class, new viewport units, Cascade Layers, focus visible , accent color, appearance, font palettes for color fonts, BroadcastChannel, Web Locks API, File System Access API , enhancements to WebAssembly, support for Display-P3 in canvas , additions to COOP and COEP, improved CSS autocompletion and new CSS variable tooling in Web Inspector, and much, much more.

We’re excited to announce today the major web technologies shipping in Safari 16 beta.

You can try out Safari 16 on macOS Monterey or macOS Big Sur by downloading the Safari 16.0 public beta . You will need to sign in using a free Apple ID to download. Note that installing Safari 16 beta will replace your existing Safari install with no way to revert to an earlier version.

Or, if you’d like, you can test Safari 16 by installing the public beta of macOS Ventura, iOS 16, or iPadOS 16.

Safari 16 brings support for Web Inspector Extensions, so you can enhance Safari’s built-in browser developer tools. This can be especially helpful when using powerful third-party frameworks and services — perhaps your team uses React, Angular, Vue, or Ember; or maybe a popular test suite or another developer service. Now with Safari Web Inspector Extensions, you’ll be able install developer tools extensions from those frameworks and services to make your job developing with them faster and easier. Look for such extensions in the App Store this fall.

Extensions for popular third-party frameworks and services aren’t the only exciting use of Web Inspector Extensions. Often, a small enhancement to developer tools can make a huge difference in workflow. You might be the best person to imagine and create such an extension. Web extensions are made from HTML, CSS, and JS — a perfect project for web developers. To learn the basics of building a Safari Web Extension , either from a quick-start template or by converting an existing extension to work with Safari, along with how to package it for the App Store, watch the Tech Talk Build and deploy Safari Extensions .

Safari Web Inspector Extensions are made with the same JavaScript APIs as the developer tools extensions in other browsers. This makes it possible for the creators of your favorite developer tools extensions to easily port them to Safari .

Web Inspector Extensions join other improvements to Safari Web Extensions, including the ability to sync which extensions are enabled across iOS, iPadOS, and macOS.

shared worker safari

After years of collaboration by engineers working on various browsers to figure out whether or not they would even be possible, Container Queries are finally here. Similar to Media Queries, Container Queries allow you to adjust the layout or styling of a particular item on your web page based on the size of its container rather than the size of the viewport. They’ll be an invaluable tool for creating reusable components in a design system.

Safari 16 supports size queries and container query units . “Size queries” are what web developers imagine when they talk about container queries — the opportunity to write CSS that only applies if a container is a certain size. Other ideas for style queries are also being discussed as part of Container Queries as something for the future.

Container query units are similar to viewport units, but they specify a length relative to the dimensions of a query container instead of the viewport.

a push notification on macOS

Web Push is coming to Safari 16 on macOS Ventura. This lets you remotely send notifications to users of your websites and web apps — and deliver those notifications even when Safari isn’t running. It uses the same combination of web standards you may be familiar with from other browsers: Push API and Notifications API , along with Service Worker .

Users opt into notifications by first indicating interest through a user gesture — such as clicking a button. Then, they’ll be prompted to give permission for your site or app to send notifications. Users will be able to view and manage notifications in Notifications Center, and customize styles and turn notifications off per website in Notifications Settings.

If you’ve already implemented Web Push for your web app or website using industry best practices, it will automatically work in Safari. Although, if you’ve excluded Safari through browser detection, you’ll need to switch to feature detection to get it working.

Web Push in Safari uses the same Apple Push Notification service that powers native push on all Macs and iOS devices. If you tightly manage push endpoints on your server, be sure you allow URLs from any subdomain of push.apple.com. You do not need to be an Apple Developer Program member.

And look for Web Push for iOS and iPadOS in 2023.

shared worker safari

CSS Grid shipped over five years ago, in March 2017, revolutionizing what’s possible in layout design on the web. Subgrid takes Grid to another level, providing an easy way to put grandchildren of a grid container on that grid. It makes it possible to line up items across complex layouts without being constrained by the HTML structure. And Safari’s Grid Inspector lets you turn on the overlays for as many grids as you want — which is especially helpful when coding subgrid.

shared worker safari

Following last year’s Grid Inspector , Safari 16 adds a Flexbox Inspector. It pairs perfectly with the addition of the Alignment Editor in Safari 15.4.

Overlays for Flexbox containers make it easier to visualize the effects your CSS has on Flexbox containers. The new overlay helps you visually distinguish between free space and gaps. It also shows the bounds of items revealing how they are distributed both on the main axis and cross axis of your Flexbox containers. The toggle-able “Order Numbers” option helps show the layout order of elements in the container, which can be helpful when using the order CSS property for items. And, just like our overlays for Grid last year, you can turn on as many Flexbox overlays as you need, without impacting performance.

Safari 16 introduces a re-architecture of WebKit’s accessibility support on macOS that delivers improved performance and increased responsiveness. This change allows WebKit to service more accessibility requests from clients like VoiceOver in less time than before. On some complex webpages, we’ve measured twice the number of accessibility requests served in twenty-five percent less time.

This release also greatly improves accessibility support for elements with display:contents by ensuring they are properly represented in the accessibility tree.

CSS Offset Path (also known as Motion Path) provides web developers a way to animate things along a custom path of any shape. The offset-path property let’s you define a geometrical path along which to animate. The offset-anchor , offset-distance , offset-position , and offset-rotate properties give you additional abilities to refine the exact movement of the object being animated. While the offset property acts as a shorthand for combining these properties.

With Safari 16, you can now animate a CSS Grid. That means changes in the size of rows and/or columns can be animated, opening up a whole new set of possibilities for movement on a page.

Safari 16 also adds support for composite operations, resolving how an element’s animation impacts its underlying property values. And it adds support for discrete animation to thirty-nine CSS properties — see the full list in the Safari Technology Preview 143 release notes .

CSS Overscroll Behavior determines what happens when a user scrolls and reaches the boundary of a scrolling area. It’s useful when you want to stop scroll chaining — when a user scrolls inside a box and hits the end, you now have control over stopping or allowing scrolling on the rest of the page.

Just when you thought there weren’t enough different kinds of workers, there’s a new type of worker in Safari — Shared Worker . Like Service Worker, a Shared Worker runs JavaScript in the background, but its lifetime is slightly different. Your Shared Worker runs as long as the user has any tab open to your domain, and all the tabs open to the same domain can share the same Shared Worker. So, if you want to do something like have one WebSocket connection open to a server that communicates on behalf of multiple tabs, try out Shared Worker.

There’s much more, including fixes and improvements to form controls as well as support for <form>.requestSubmit() and the showPicker() method for HTML input elements. Plus support for Shadow Realms, as well as support for the worker-src Content Security Policy directive.

To learn more about what’s in Safari 16 for web developers, including a list of bug fixes, read the Safari 16 beta release notes .

We love hearing from you. Send a tweet to @webkit , @jensimmons , or @jonathandavis to share your thoughts on this release. What technology from Safari 16 are you most excited about? What features or fixes do you want to see next? If you run into any issues, we welcome your feedback on Safari UI, or your WebKit bug report about web technology or Web Inspector. Filing issues really does make a difference.

Download the latest Safari Technology Preview to stay at the forefront of the web platform and to use the latest Web Inspector features. You can also use the WebKit Feature Status page to watch for new information about the web features that interest you the most.

  • Skip to main content
  • Select language
  • Skip to search
  • SharedWorker()

The SharedWorker() constructor creates a SharedWorker object that executes the script at the specified URL. This script must obey the same-origin policy .

If the URL has an invalid syntax or if the same-origin policy is violated, a DOMException of type SECURITY_ERR is thrown.

Note : there is disagreement among browser manufacturers about whether a data URI is of the same origin or not. Although Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) and later accept data URIs, that's not the case in all other browsers.

  • type : A DOMString specifying the type of worker to create. The value can be classic or module . If not specified, the default used is classic .
  • credentials : A DOMString specifying the type of credentials to use for the worker. The value can be omit , same-origin , or include . If not specified, or if type is classic , the default used is omit (no credentials required).
  • name : A DOMString specifying an identifying name for the SharedWorkerGlobalScope representing the scope of the worker, which is mainly useful for debugging purposes.

Return value

The created worker

  • SecurityError is raised if the document is not allowed to start workers
  • NetworkError is raised if the MIME type of one of the script is text/csv , image/* , video/* , or audio/* . It should always be text/javascript .
  • SyntaxError is raised if aURL cannot be parsed.

The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor and subsequent usage of the object:

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

Specifications

Browser compatibility.

  • The SharedWorker interface it belongs to.

Document Tags and Contributors

  • Constructor
  • Shared Workers
  • SharedWorker
  • Web Workers
  • Web Workers API
  • EventTarget
  • AbstractWorker
  • ChromeWorker
  • DedicatedWorkerGlobalScope
  • ServiceWorker
  • SharedWorkerGlobalScope
  • WorkerGlobalScope
  • WorkerLocation
  • WorkerNavigator

@okikio/sharedworker

@okikio/sharedworker

Sharedworkers on all browsers, yay 🎉.

Okiki Ojo's photo

Table of contents

For bundlejs.com , and astro.build/play , I found that I needed a way to use SharedWorkers reliably on all browsers, so, I decided to make a miniature script that would act as a wrapper around the SharedWorker class, by default it would try to create a SharedWorker but if unssuported it would otherwise switch to normal web workers this makes, SharedWorkers a type of progressive enhancement .

When I realized that a polyfill/ponyfill doesn't exist for SharedWorkers I realized I needed to make one, and to ensure reliable that the polyfill was thoroughly vetted and tested for cross browser compatibility, so, I made @okikio/sharedworker .

@okikio/sharedworker is a small mostly spec. compliant polyfill/ponyfill for SharedWorkers , it acts as a drop in replacement for normal Workers , and supports a similar API surface that matches normal Workers .

You use it like this,

shared-worker.js

In the cases of bundlejs.com and astro.build/play , @okikio/sharedworker was used for esbuild as well as the monaco-editors editor and typescript workers. @okikio/sharedworker was used as a separate utility file for easy access.

The major limitation with @okikio/sharedworker is that on browsers that don't natively support SharedWorker , you can't use @okikio/sharedworker as an across tab communication tool. But for everything else it's feature parity and spec. compliance should be great.

So, will you use it? Tell me below, or say Hi on twitter .

Image from Tengyart on Unsplash .

Did you find this article valuable?

Support Okiki Ojo by becoming a sponsor. Any amount is appreciated!

How to debug shared worker in Safari?

I am using Safari Technology Preview(16 version).

With this version we can use Shared Worker, but how to debug it?

For example, for Service Workers I see a separate menu item, but for Shared Workers I didn't find anything.

Is there anyone who knows how to debug Shared Worker and see its logs?

  • Safari Developer Tools

Have you found the answer?

  • Skip to main content
  • Select language
  • Skip to search
  • Sign in Github
  • SharedWorker()
  • 中文 (简体) (zh-CN)
  • Add a translation
  • Print this article

Specifications

Browser compatibility.

The SharedWorker() constructor creates a SharedWorker object that executes the script at the specified URL. This script must obey the same-origin policy .

If the URL has an invalid syntax or if the same-origin policy is violated, a DOMException of type SECURITY_ERR is thrown.

Note : there is disagreement among browser manufacturers about whether a data URI is of the same origin or not. Although Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7) and later accept data URIs, that's not the case in all other browsers.

  • type : A DOMString specifying the type of worker to create. The value can be classic or module . If not specified, the default used is classic .
  • credentials : A DOMString specifying the type of credentials to use for the worker. The value can be omit , same-origin , or include . If not specified, or if type is classic , the default used is omit (no credentials required).
  • name : A DOMString specifying an identifying name for the SharedWorkerGlobalScope representing the scope of the worker, which is mainly useful for debugging purposes.

Return value

The created worker

  • SecurityError is raised if the document is not allowed to start workers
  • NetworkError is raised if the MIME type of one of the script is text/csv , image/* , video/* , or audio/* . It should always be text/javascript .
  • SyntaxError is raised if aURL cannot be parsed.

The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor and subsequent usage of the object:

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

  • The SharedWorker interface it belongs to.

Document Tags and Contributors

  • Constructor
  • SharedWorker
  • Web Workers
  • Web Workers API
  • EventTarget
  • AbstractWorker
  • ChromeWorker
  • DedicatedWorkerGlobalScope
  • ServiceWorker
  • SharedWorkerGlobalScope
  • WorkerGlobalScope
  • WorkerLocation
  • WorkerNavigator

Learn the best of web development

Get the latest and greatest from MDN delivered straight to your inbox.

Thanks! Please check your inbox to confirm your subscription.

If you haven’t previously confirmed a subscription to a Mozilla-related newsletter you may have to do so. Please check your inbox or your spam filter for an email from us.

Web Workers

Method of running scripts in the background, isolated from the web page

  • 4 - 123 : Supported
  • 124 : Supported
  • 125 - 127 : Supported
  • 12 - 123 : Supported
  • 3.1 - 3.2 : Not supported (but has polyfill available)
  • 4 - 17.3 : Supported
  • 17.4 : Supported
  • 17.5 - TP : Supported
  • 2 - 3 : Not supported (but has polyfill available)
  • 3.5 - 124 : Supported
  • 125 : Supported
  • 126 - 128 : Supported
  • 9 - 9.6 : Not supported
  • 10 - 10.5 : Not supported (but has polyfill available)
  • 10.6 - 108 : Supported
  • 109 : Supported
  • 5.5 : Not supported
  • 6 - 9 : Not supported (but has polyfill available)
  • 10 : Supported
  • 11 : Supported

Chrome for Android

Safari on ios.

  • 3.2 - 4.3 : Not supported
  • 5 - 17.3 : Supported
  • 17.5 : Supported

Samsung Internet

  • 4 - 23 : Supported
  • 24 : Supported
  • all : Not supported

Opera Mobile

  • 10 : Not supported (but has polyfill available)
  • 11 - 12.1 : Supported
  • 80 : Supported

UC Browser for Android

  • 15.5 : Supported

Android Browser

  • 2.1 : Supported
  • 2.2 - 4.3 : Not supported
  • 4.4 - 4.4.4 : Supported

Firefox for Android

  • 14.9 : Supported

Baidu Browser

  • 13.52 : Supported

KaiOS Browser

  • 2.5 : Supported
  • 3 : Supported

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

A small spec. compliant polyfill for SharedWorkers, it acts as a drop in replacement for normal Workers.

okikio/sharedworker

Folders and files, repository files navigation, @okikio/sharedworker.

Open Bundle

NPM | Github | Docs | Licence

A small mostly spec. compliant polyfill/ponyfill for SharedWorkers , it acts as a drop in replacement for normal Workers , and supports a similar API surface that matches normal Workers .

Ponyfills are seperate modules that are included to replicate the functionality of the original API, but are not required to be used. Polyfills update the original API on the global scope if it isn't supported in that specific environment or it's feature set is lacking compared to modern variations.
Check out the blog post , created for it's launch.

Installation

You can also use it directly through a script tag:

You can also use it via a CDN, e.g.

@okikio/sharedworker supports the same API surfaces as SharedWorker and Worker , except it adds some none spec. compliant properties and methods to the SharedWorkerPolyfill class, that enables devs to use SharedWorker 's on browsers that don't support it.

In order to support browsers that don't natively support SharedWorker 's, the actual worker file needs to be tweaked slightly,

Note : make sure to read the comments in the above code carefully to avoid unexpected bugs.

A couple sites that use @okikio/sharedworker :

  • astro.build/play - GitHub
  • bundlejs.com - GitHub
  • Your site here...

The API of @okikio/sharedworker closely match the web SharedWorker API, except that all the major methods and properties of SharedWorker.prototype.port are available directly on SharedWorker.prototype including addEventListener and removeEventListener .

Note: the normal functionality of the methods and properties that are normally available on SharedWorker.prototype will still be kept intact, in @okikio/sharedworker .

In addition, the terminate() method was added to @okikio/sharedworker , this allows both the close() method (this is from SharedWorker.prototype.port ) and the terminate() method to manually close workers.

Check out the API site for detailed API documentation.

Browser Support

Native support for SharedWorker is not supported at all on Safari and IE, as well as all mobile browsers (excluding Firefox For Android).

Note: some features of Workers appeared at later versions of the spec., so, I suggest looking into the feature support table for Workers and SharedWorkers .

Contributing

I encourage you to use pnpm to contribute to this repo, but you can also use yarn or npm if you prefer.

Install all necessary packages

Then run tests (WIP)

Build project

Preview API Docs

Note : this project uses Conventional Commits standard for commits, so, please format your commits using the rules it sets out.

See the LICENSE file for license rights and limitations (MIT).

Contributors 5

@okikio

  • JavaScript 49.6%
  • TypeScript 31.1%
  • Dockerfile 2.5%
  • FanNation FanNation FanNation
  • SI.COM SI.COM SI.COM
  • SI Swimsuit SI Swimsuit SI Swimsuit
  • SI Sportsbook SI Sportsbook SI Sportsbook
  • SI Tickets SI Tickets SI Tickets
  • SI Showcase SI Showcase SI Showcase
  • SI Resorts SI Resorts SI Resorts

Jan 16, 2023; Tampa, Florida, USA; Tampa Bay Buccaneers quarterback Tom Brady (12) reacts before the

© Kim Klement-USA TODAY Sports

Radio Legend Says He Doesn't Think Ex-Buccaneers QB Tom Brady Will Work as Broadcaster

Former Tampa Bay Buccaneers quarterback Tom Brady has his fair share of detractors as he prepares for a broadcast role.

  • Author: David Harrison

In this story:

Tom Brady went from the bench in Michigan to the 6th Round of the NFL Draft to becoming the greatest quarterback to ever play the game and the leader of the Tampa Bay Buccaneers' second Super Bowl-winning team.

In every stop of Brady's career he's been doubted, and even after winning six Super Bowls with the New England Patriots there were those who dare call the future Hall of Famer 'washed'.

Now, in his post-retirement life, Brady has opted to follow up his exit from Tampa Bay football with a trip upstairs to the same broadcast booths where some of the best in the sports commentary business narrated the story of his own on-field accomplishments.

And one radio personality, Mike Francesca, is getting in line as one of Brady's latest doubters.

"I don't think his heart is in it," Francesca said according to Mail Online . "I don't think his personality is such. I don't think he's going to be great at it. I really don't... I think there's a unique quality that you have to bring that allows you as an analyst to see the game, see the game quickly, plus bring personality into it.... You're going to spend a lot of time breaking down what happens on replay. And you also have to be very personable and glib in how you do it. I don't see him there.'

Francesca isn't alone in his doubts that Brady is cut out for the job. Other former NFL players have entered the broadcast business and have had varying levels of success.

The most successful in recent memory could arguably be former Dallas Cowboys quarterback Troy Aikman along with Tony Romo, formerly of the same franchise.

Even more have taken shots at doing the job and fizzled out or never even made it past the screen tests.

Brady is slated to be on the top broadcast pairing in Fox's lineup of broadcast duos, pushing former NFL tight end Greg Olsen down a peg. Plenty feel Olsen should be left in his spot and Brady allowed to enter at a lower level until he proves himself.

Regardless of the doubts, Brady is scheduled to get started this season.

“I’m already working hard on trying to make sure I’m ready for that opportunity, and I’m prepared mentally and emotionally for that challenge," Brady said about the job on his popular 'Let's Go!' podcast. "Because it is a challenge. It’s something that’s new, it’s outside of my comfort zone. And I’m excited to get out there and try something and see how I do."

Stick with  BucsGameday  for more coverage of the Tampa Bay Buccaneers throughout the 2024 offseason.

Latest Buccaneers News

Lavonte Pantherts

BREAKING: Buccaneers' Re-Sign Defensive Star As They Continue to Bolster Roster

1627447256

Tampa Bay Buccaneers Officially Announce Veteran Defensive Lineman Re-Signing

Tampa Bay Buccaneers general manager Jason Licht speaking at the 2023 NFL Scouting Combine.

Buccaneers GM Jason Licht Garners Praise For Day 1 of Free Agency

bucs mike evans

Mike Evans, Baker Mayfield Contracts Earn Buccaneers Strong Free Agency Grades from PFF

Feb 7, 2020; Tampa, FL, USA; Tampa Bay Buccaneers cornerback Carlton Davis (24) celebrates after defeating the Kansas City Chiefs in Super Bowl LV at Raymond James Stadium. Mandatory Credit: Kim Klement-USA TODAY Sports

Former Auburn Tiger involved in NFL trade

Bird flu cases are likely being missed in dairy workers, experts say

A dairy worker prepares a cow for milking inside the dairy barn at a farm in Ancramdale, N.Y

Dr. Barb Petersen, a dairy veterinarian in Amarillo, Texas, had been caring for sick cows for several weeks in March when she and a colleague finally pinned down the cause of the illness among the herd: the H5N1 strain of the bird flu .

It was the first time the virus had been detected in cattle.

The sick cows, said Petersen, who owns Sunrise Veterinary Service, tended to produce milk that didn’t look quite right, and had mastitis, an inflammation of the udders.

During that same time, she said, dairy workers — including those who were never in close contact with the sick cows — also fell ill.

“People had some classic flu-like symptoms, including high fever, sweating at night, chills, lower back pain,” as well as upset stomach, vomiting and diarrhea, Petersen said. “They also tended to have “pretty severe conjunctivitis and swelling of their eyelids.”

Petersen noted that the people were never tested for H5N1; it’s possible that their symptoms were the result of another illness.

Since the outbreak in cows was announced in late March, bird flu has been detected in  33 dairy herds in nine states : Colorado, Idaho, Kansas, Michigan, New Mexico, North Carolina, South Dakota, Ohio and Texas.

So far just one person, a dairy worker in Texas , has tested positive for the virus. The person’s case was mild, the Centers for Disease Control and Prevention said. The only symptom involved was conjunctivitis, or pinkeye.

At least 44 others may have been exposed, the CDC said. Some have been tested, while others were asked to monitor symptoms, such as cough, sore throat, pinkeye, fever, headache and diarrhea.

Dr. Keith Poulsen, director of the Wisconsin Veterinary Diagnostic Laboratory, said he’s heard reports of flu-like illnesses on affected dairy farms.

“It’s certainly not a large amount,” he said, “but there’s probably a lot of cases that are not documented.”

Several factors may prevent sick dairy workers from seeking medical care or farmers from even reporting a positive case among their cattle.

Farming, especially in rural areas with fewer medical centers, is often a 24/7 job without the benefit of sick days. What’s more, false information circulating across farming communities is fueling a tremendous amount of fear that dairy farmers could lose their livelihood if they are tagged as harboring H5N1, Poulsen said.

“The biggest concern that we hear our dairy farmers say is, ‘I don’t want to test because they’re going to depopulate my herd,’” he said. “Misinformation out there is really challenging because that’s really not the case.”

“Our job right now is to protect farmworkers,” said Jennifer Nuzzo, director of the Pandemic Center at Brown University School of Public Health. “We can’t do that unless we know where the virus is or where it isn’t.”

It’s still unclear how the bird flu virus spreads from cows to people, though some experts said it could be through multiple paths, such as contact with milk, contaminated milking equipment, or even respiratory droplets.

“I think everything’s on the table at this point,” said Dr. Andrew Bowman, a veterinary epidemiologist at the Ohio State University.

On Thursday, the Food and Drug Administration said that genetic traces of the virus have been detected in 1 in 5 samples of pasteurized milk .

Preliminary results announced Friday by the agency said that pasteurization kills the virus, adding that the testing “did not detect any live, infectious virus” in commercially sold milk. The FDA said it was testing 297 samples from 38 states.

The FDA said it had also tested several powdered infant and toddler formulas and found no evidence of bird flu virus. It was unclear how many formula samples the agency had tested.

Meanwhile, experts recommend that anyone in contact with dairy cattle wear protective equipment, including safety glasses or goggles, waterproof aprons and boots that can be sanitized.

Poulsen encouraged dairy farmers to be as up front as possible about the virus. The more time it has to replicate in cows and other mammals, the stronger it might become, he said.

“The longer that we let this go unchecked or uncontrolled,” he said, “it becomes a much, much bigger problem that could make Covid look easy.”

shared worker safari

Erika Edwards is a health and medical news writer and reporter for NBC News and "TODAY."

  • Share full article

Advertisement

Supported by

McKinsey Is Under Criminal Investigation for Its Opioid Work

Federal prosecutors are examining the consulting company’s role in helping “turbocharge” the sale of painkillers like OxyContin.

A black-and-white desk bearing the logo of McKinsey & Company in a corporate lobby.

By Glenn Thrush ,  Michael Forsythe and Walt Bogdanich

Glenn Thrush covers the Justice Department for The Times. Michael Forsythe and Walt Bogdanich, authors of “When McKinsey Comes to Town,” have been reporting on the consulting firm for years.

The Justice Department is investigating McKinsey & Company, the international consulting giant, for its role in helping drug companies maximize their sale of opioids.

The investigation is led by the U.S. attorneys’ offices in Massachusetts and the Western District of Virginia in coordination with the department’s civil division in Washington, according to two officials familiar with the case who spoke on condition of anonymity.

Since 2021, McKinsey has agreed to pay about $1 billion to settle investigations and lawsuits across the United States related to the firm’s work with opioid makers, principally Purdue Pharma, the maker of OxyContin. McKinsey recommended that Purdue “turbocharge” its sales of the drug in the midst of the opioid crisis, which has killed hundreds of thousands of Americans. McKinsey has not admitted any wrongdoing.

News of the criminal investigation was first reported by The Wall Street Journal on Wednesday.

The investigation has been underway for several years. Endo, a pharmaceutical company that hired McKinsey to advise on the sale of the opioid Opana, said in a regulatory filing that it received a subpoena in December 2020 from the Western District of Virginia seeking information about McKinsey. The New York Times reported on the existence of that subpoena in 2022. Last year another opioid maker, Mallinckrodt, said it received a grand jury subpoena from the same U.S. attorney’s office but did not mention any connection to McKinsey.

Federal prosecutors are also looking into whether McKinsey obstructed justice in its handling of records, according to The Journal.

By 2018, senior McKinsey consultants were growing increasingly worried that they might be held to account for their opioid work. On July 4 of that year, Martin Elling, a leader in the firm’s pharmaceutical practice, made a decision he would later regret. He sent an email to Arnab Ghatak, a senior partner, asking whether they should eliminate documents and emails connected to opioids.

Mr. Ghatak replied: “ Thanks for the heads up. Will do .”

Both men were fired after The Times reported in 2020 about the existence of the emails.

It isn’t unusual for criminal investigations like this to go on for many years, especially ones involving two U.S. attorneys’ offices, the Justice Department and possibly state agencies as well, Rick Mountcastle, a former federal prosecutor, said.

He led a criminal investigation into Purdue Pharma that resulted in the company’s guilty plea in 2007 to having misled regulators, doctors and patients about the dangers of OxyContin. “It is a huge monster bureaucracy that moves at a very slow pace,” said Mr. Mountcastle, who was not a source confirming the existence of the investigation.

McKinsey made about $86 million over many years advising Purdue Pharma. The bulk of that work took place after Purdue’s guilty plea. In 2019, McKinsey said it would no longer advise clients on opioid-related business.

Ramiro Prudencio, a spokesman for McKinsey, declined to comment. A spokesman for the Justice Department had no comment on the case.

Glenn Thrush covers the Department of Justice. He joined The Times in 2017 after working for Politico, Newsday, Bloomberg News, The New York Daily News, The Birmingham Post-Herald and City Limits. More about Glenn Thrush

Michael Forsythe a reporter on the investigations team at The Times, based in New York. He has written extensively about, and from, China. More about Michael Forsythe

Walt Bogdanich joined The Times in 2001 as investigative editor for the Business desk. Since 2003, he has worked as an investigative reporter. He has won three Pulitzer Prizes. More about Walt Bogdanich

IMAGES

  1. Safari Park Worker Becomes Best Friends With A Cuddly Lion

    shared worker safari

  2. Tanzania Group Joining Safari

    shared worker safari

  3. Support Safaris R Us safari workers

    shared worker safari

  4. A Good Safari Guide Can Make a Long Journey In the Wilds A Memorable

    shared worker safari

  5. How to use Shared Links with Safari on iPhone and iPad

    shared worker safari

  6. 6 Days Shared Safari Tanzania

    shared worker safari

COMMENTS

  1. SharedWorker

    The following code snippet shows creation of a SharedWorker object using the SharedWorker() constructor. Both scripts contain this: js. const myWorker = new SharedWorker("worker.js"); Note: Once a shared worker is created, any script running in the same origin can obtain a reference to that worker and communicate with it.

  2. Why did Safari drop support for SharedWorker?

    Since safari default's behaviour on cookies is preventing third-party cookies on tracking. If safari allows us to use SharedWorker, developer (google or tracking company) can use it to access identify between different window tab. That's the reason why safari drop the SharedWorker, interestingly, it support WebWorker but not SharedWorker.

  3. Safari now fully supports SharedWorkers

    At this point, the neo.mjs workers setup runs right away inside Safari: This is also true in case we switch to the SharedWorkers scope. This enables us to directly communicate across multiple browser windows and share the same backend (API) data, which results in less calls to the BE. The performance gains are stunning.

  4. WebKit Features in Safari 16.0

    Your Shared Worker runs as long as the user has any tab open to your domain. All the tabs open to the same domain can share the same Shared Worker. Additional Features. Safari 16 adds support for Shadow Realms, <form>.requestSubmit(), the showPicker() method for HTML input elements, and the worker-src Content Security Policy directive. Fixes ...

  5. Shared Web Workers

    Shared Web Workers - LS Global usage ... Safari on iOS. 3.2 - 4.3: Not supported; 5 - 6.1: Supported; 7 - 15.8: Not supported; ... Usage share statistics by StatCounter GlobalStats for March, 2024 Location detection provided by ipinfo.io. Browser testing done via

  6. SharedWorker

    Shared Worker. Shared. Worker. The SharedWorker interface represents a specific kind of worker that can be accessed from several browsing contexts, such as several windows, iframes or even workers. They implement an interface different than dedicated workers and have a different global scope, SharedWorkerGlobalScope.

  7. Using Web Workers

    Web Workers API. A worker is an object created using a constructor (e.g. Worker()) that runs a named JavaScript file — this file contains the code that will run in the worker thread; workers run in another global context that is different from the current window. Thus, using the window shortcut to get the current global scope (instead of self ...

  8. How to Use JavaScript Shared Web Workers in HTML5

    Currently, shared web workers are supported in Chrome, Safari and Opera. Firefox 4 and IE9 support may arrive, but don't bet on it. Shared workers may save resources but they add an extra level ...

  9. SharedWorker

    var myWorker = new SharedWorker('worker.js'); Both scripts then access the worker through a MessagePort object created using the SharedWorker.port property. If the onmessage event is attached using addEventListener, the port is manually started using its start() method: myWorker.port.start(); When the port is started, both scripts post messages ...

  10. News from WWDC22: WebKit Features in Safari 16 Beta

    Just when you thought there weren't enough different kinds of workers, there's a new type of worker in Safari — Shared Worker. Like Service Worker, a Shared Worker runs JavaScript in the background, but its lifetime is slightly different. Your Shared Worker runs as long as the user has any tab open to your domain, and all the tabs open to ...

  11. SharedWorker()

    Worker () In This Article. The SharedWorker() constructor creates a SharedWorker object that executes the script at the specified URL. This script must obey the same-origin policy. If the URL has an invalid syntax or if the same-origin policy is violated, a DOMException of type SECURITY_ERR is thrown. Note: there is disagreement among browser ...

  12. @okikio/sharedworker, supporting SharedWorkers on all browsers

    Usage. @okikio/sharedworker is a small mostly spec. compliant polyfill/ponyfill for SharedWorkers, it acts as a drop in replacement for normal Workers, and supports a similar API surface that matches normal Workers.. You use it like this, shared-worker.js /* * All variables and values outside the `start(...)` function are shared between all pages, this behavior can cause unexpected bugs if you ...

  13. How to debug shared worker in Safari?

    I am using Safari Technology Preview (16 version). With this version we can use Shared Worker, but how to debug it? For example, for Service Workers I see a separate menu item, but for Shared Workers I didn't find anything. Is there anyone who knows how to debug Shared Worker and see its logs?

  14. SharedWorker()

    The SharedWorker() constructor creates a SharedWorker object that executes the script at the specified URL. This script must obey the same-origin policy. If the URL has an invalid syntax or if the same-origin policy is violated, a DOMException of type SECURITY_ERR is thrown. Note: there is disagreement among browser manufacturers about whether ...

  15. Web Workers

    Safari. 3.1 - 3.2: Not supported (but has polyfill available) 4 - 17.3: Supported; ... Shared Web Workers. Can I use... Browser support tables for modern web technologies ... design by @Lensco. Support data contributions by the GitHub community. Usage share statistics by StatCounter GlobalStats for March, 2024 Location detection provided by ...

  16. GitHub

    Native support for SharedWorker is not supported at all on Safari and IE, as well as all mobile browsers (excluding Firefox For Android). Note: some features of Workers appeared at later versions of the spec., so, I suggest looking into the feature support table for Workers and SharedWorkers.

  17. Debugging Web Workers

    For shared worker, you would need to go to chrome://inspect/#workers. Select "Shared workers" on the left panel. You would be able to see a list of shared workers if you have any running. You can click "inspect", which will open a new console for you to debug. Firefox. For Firefox, you could go to about:debugging#workers. You will be able to ...

  18. Beloved Ostrich Dies at Kansas Zoo After Swallowing Worker's Keys

    Karen, a 5-year-old known for her playful antics, reached beyond her enclosure, grabbed a staff member's keys and swallowed them, the zoo said. Attempts to save her were unsuccessful.

  19. Who is Rhona Graff, Trump's Former Assistant Who Is Testifying Against

    Few people knew Donald J. Trump like Ms. Graff, a Queens native who made a career serving the defendant. By Matthew Haag For decades, few people had access to Donald J. Trump like Rhona Graff. Now ...

  20. Daimler Truck Workers Reach Deal and Avert Threatened Strike in North

    The United Automobile Workers reached an 11th-hour deal on Friday with Daimler Truck in North Carolina that gave workers 25 percent raises over the next four years and averted a strike that would ...

  21. javascript

    62. Navigate to chrome://inspect/#workers and find the shared worker and click on "inspect". Then you can pull up the console for the SharedWorker. edited Apr 9, 2018 at 9:40. cuixiping.

  22. Radio Legend Says He Doesn't Think Ex-Buccaneers QB Tom Brady Will Work

    Tom Brady went from the bench in Michigan to the 6th Round of the NFL Draft to becoming the greatest quarterback to ever play the game and the leader of the Tampa Bay Buccaneers' second Super Bowl ...

  23. Ex-mortuary worker pleads guilty to selling 24 boxes of body parts

    A former mortuary worker in Arkansas pleaded guilty to transporting stolen body parts across state lines, federal prosecutors said Thursday. Candace Chapman Scott, 37, of Little Rock, also pleaded ...

  24. Bird flu cases are likely being missed in dairy workers, experts say

    Their focus is on keeping the people who work with cows from getting sick. A worker prepares a cow for milking in Ancramdale, N.Y., on May 22, 2020. Angus Mordant / Bloomberg via Getty Images file

  25. Quotation of the Day: What Is a 'Decent Wage'? France's Michelin

    Share full article. ... on his guarantee that all of the company's 132,000 workers at 131 factories in 26 countries would earn a decent wage, wherever they were in the world. Page B1.

  26. McKinsey Is Under Criminal Investigation for Its Opioid Work

    Share full article. Since 2021, McKinsey has agreed to pay about $1 billion to settle investigations and lawsuits across the United States related to the firm's work with opioid makers.