FALLING BACK FOR NON-WEB WORKER BROWSERS
When your Web Worker code is functioning properly, what do you do about the users who have not yet upgraded their web browsers? You still want these users to use your website, despite the known issues running processor-intensive code. By activating Web Workers, you have cut off these legacy users entirely!
First, you will need to split up your CPU-intensive code into two separate files, one that provides Web Worker functionality and one that does not. This is actually already demonstrated in this chapter, as the previous sections show a legacy program running the original code and another running the Web Worker setup code.
Next, in your parent script, you will need to detect whether Web Worker support ...
Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.