Web Worker: a concurrent application
The Worker object run a script at the same time a page is displayed, operating asynchronously and that communicate with the page.
Ajax may be used when data stored on the server are needed, while a Worker is relevant when they are provided by the user.
Be warned first: Creating a worker is very costly in resources: we should not create multiple instances simultaneously if we want the app to work on all computers including the less powerful.
The Worker object
Compatibility: IE 10, Firefox 31, Chrome 31, Safari 7, latest Android et iOS.
To simplify the demonstration, we use very a short script (the calculation of the greatest common divisor), while in production only a long processing justify the use of a Worker.
Enter two numbers and click on the Send button
Greatest common denominator:
The SharedWorker object
Compatibility: Edge, Firefox 31, Chrome 31. No mobile. (In may 2015).
A Worker uses a lot of resources and it is one of the reasons why SharedWorker exists: it allows a single script running in parallel to be used by several windows or frames. Another equally important reason is that it allows them to communicate.
But SharedWorker object is not supported by Internet Explorer. It is by the Edge browser in Windows 10.
They are also other ways to exchange data between windows and iframes as described in the article: Let iframes to communicate.