Problem
If you use Firebug and see where jQuery loads, you can see how Google successfully downloaded it. Why is this not working? Since the requests are asynchronous and your script runs synchronously, it takes all the steps until the first script is loaded.
So:
- jQuery no.
- Add a script element to download from Google (the browser sends a request and continues to execute the script)
- jQuery no add another source
- ...
etc.
Decision
What you need to do is attach the script load elements to the onLoad event and check jQuery after loading them.
Script is executed at lightning speed compared to sending a request to a server on the Internet and receiving results for processing.
Additional notes
As I already read, you will have problems finding 404s using this technique. The proposed method is to use Ajax (XHR), and then attach the script element and add the received content to it. This would be the most reliable way to do this for all browsers.
Robert Koritnik
source share