Reputation: 2057
I have a site with a bunch of images on it placed in there manually using image tags. How do you go about preloading them? When I view them in the network tab, the page image loads first, then the web worker loads them after the case. How can I make the script run first?
Upvotes: 0
Views: 930
Reputation: 993
You can't with Web Workers.
Web workers is an asynchronous process and, by definition, runs outside of the normal control flow. If you want the images to load before, don't use Web Workers.
See: The definitive best way to preload images using JavaScript/jQuery?
Upvotes: 2