I am downloading the JS file asynchronously by appending the JS file to HTML head. Now in html body, before using the JS file, I want to check if JS file has downloaded and is present in the cache. If the JS file is NOT present in the cache(e.g: in case of slow internet connnections), I want to block until it is downloaded. In other words, if JS download is not complete, i want to simulate the behavior as in the case of blocking JS download.
Any idea how this can be achieved?