Ramlal S
Ramlal S

Reputation: 1643

online cdnjs script is not attaching(loading) while page runing on browser

In my HTML page i want to load the following CDNjs

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script>

but in the browser it loads as follows

GET http://localhost:8080/cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js 404 (Not Found)

Now, my question is how to eliminate that attaching the Domain name(localhost:8080) to load my script properly. I also tried it as

<script src="../cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script>

or

<script src="../../cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script> But the result is same.

Thank you.

Upvotes: 2

Views: 1323

Answers (4)

Kiran Kumar Kotari
Kiran Kumar Kotari

Reputation: 1160

Check the examples in tether I found sample here we are using as below, which you can modify to cdnjs link. I recommend to open in incognito mode.

There are several ways to execute an external script:

  • If async is present: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)

example:-

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js" async></script>
  • If async is not present and defer is present: The script is executed when the page has finished parsing

example:-

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js" defer></script>
  • If neither async or defer is present: The script is fetched and executed immediately, before the browser continues parsing the page

example:-

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script>

Upvotes: 1

Prathap Badavath
Prathap Badavath

Reputation: 1671

check following line.

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js" async></script>

Upvotes: 1

Spechal
Spechal

Reputation: 2706

You need to use the FQDN to CloudFlare. You are doing a relative path lookup currently.

You should not unclude https: here, use // and the browser wil auto-detect. i.e.

<script src="//cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script>

Upvotes: 1

Dipak
Dipak

Reputation: 2308

You should use following way to include the cdn file.

<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.3/js/tether.min.js"></script> 

Upvotes: 0

Related Questions