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?
Asked
Active
Viewed 896 times
0
-
Can you clarify what your aim is, from the user experience point of view? – Michal Charemza Jun 03 '16 at 09:15
1 Answers
2
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?

Community
- 1
- 1

Phillip Chan
- 993
- 7
- 17