In your sample code, they will download the version of Google if they do not already have it because of another site. Then, if for some reason Google does not work, they will download your version, they will not download both. The second request is only requested if the first fails (from Google).
Verification is performed as follows:
- Do we have a google cache version?
- Yes - It's good to go, use it.
- No. Download it from Google, use it.
- Is
jQuery defined (JavaScript object)?- Yes - fine, it loaded fine,
if() - false, continue. - No - oh snap! Error loading Google, either from the cache or extract, you must download it from another place
- Download it from your site using the newly added
<script> .
Nick craver
source share