0

I am using jquery in my web page so I have included the script in my HTML like this:

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.2.min.js"></script>

If I try to hit the URL: code.jquery.com/jquery-1.11.2.min.js it will not load for first few attempts. after that it will load. This is happening from past few days.

These scripts are included at the top of <head> and were working good for past and this problem is occurring from couple of days.

Is there something wrong in a way I include these or is there some change that happened in jquery?

EDIT: In developer tools I can see this:
status: (failed)
Request URL: https://code.jquery.com/jquery-1.11.2.min.js
Referrer Policy: no-referrer-when-downgrade

Request headers:
Referer: https://somePage.com/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36

If I load the page https://code.jquery.com/jquery-1.11.2.min.js in the browser it works for second or the third attempt

aja
  • 129
  • 1
  • 11
  • 2
    There is nothing wrong with the code you posted here. – 31piy May 15 '18 at 06:58
  • Add jquery fallback local file https://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – SilverSurfer May 15 '18 at 06:59
  • When you say _"it will not load"_, what **exactly** is the problem? Is it timing out? Responding with an error status? Check your browser's _Network_ console and post screenshots if there's anything interesting – Phil May 15 '18 at 07:03
  • In the status it says (failed) and there is no status code . – aja May 15 '18 at 07:18
  • 1
    maybe you can use developer tool of browser to see whether the request is sent or not, or is there a local cache matched. – York Chen May 15 '18 at 07:22
  • Could you maybe try it in safe mode of firefox. I once had the problem that a plugin blocked the script. If it runs in safe mode that means that some plugin is blocking it. – mrdeadsven May 15 '18 at 07:26
  • The request is sent I did check in developer tools and the status is (failed) and I did a hard reload ctrl+shift+r to make sure it is not from the cache @York Chen – aja May 15 '18 at 07:39
  • Its not in safe mode I am using google chrome and its not even in incognito @mrdeadsven – aja May 15 '18 at 07:41
  • @SilverSurfer as you have mentioned the answer given in [link](https://stackoverflow.com/questions/1014203/best-way-to-use-googles-hosted-jquery-but-fall-back-to-my-hosted-library-on-go?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa) did help me a lot now I am able to load the jQuery library from other location even if the CDN did not load the file – aja May 15 '18 at 11:31
  • @aja Glad to help you =). Remember script tags should be placed at the end of the `body`, before `

    ` for better performance.

    – SilverSurfer May 15 '18 at 11:55
  • @SilverSurfer cool I will keep that in mind. – aja May 15 '18 at 12:05

1 Answers1

0

I just put your CDN link both in the <head> of a file I'm working on, then tried as well at the bottom of the body and both worked. It's likely that something else in your <head> is breaking it.

If you use the same CDN in a basically empty project and just launch a single line of script like alert("it works!") does it pop up for you? If so, your script tag and CDN are not the issue.

Bill Gryta
  • 11
  • 1
  • I can see in the developer tools the request is hitting `https://code.jquery.com/jquery-1.11.2.min.js` and the response is not status 200 – aja May 15 '18 at 07:47