Incpetor
Incpetor

Reputation: 1303

Bootstrap CDN Not Loading

A simple yet annoying error.. I can't load the Bootstrap css using the cdn Here is the simple code

         <html>
         <head>
<title>Header template</title>

<!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

      </head>
  <body>
<button class="btn btn-default">Hello World</button>
  </body>
  </html>

Upvotes: 6

Views: 20317

Answers (4)

charchit
charchit

Reputation: 1522

For me it was the date and time problem. My date and time were not correct and when I visited the cdn link I got the date and time error. After correcting it was working fine.

Upvotes: 0

David De Sloovere
David De Sloovere

Reputation: 3435

Two things might cause this:

  • The obvious one is that you should remove the spaces in the first link (looks like you already edited that)

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">

  • How are you viewing this file? If it is not served via a webserver (and thus over http of https) then the protocol-less links won't work. Does your browser say file:/// etc in the address bar? Then add http:// in front of //netdna.bootstrapcdn.com

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css"> <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

Upvotes: 10

Muhammad Ali Bala
Muhammad Ali Bala

Reputation: 368

The inclusion of the “http:” or “https:” part is partly just a matter of tradition, partly a matter of actually specifying the protocol. If it is defaulted, the protocol of the current page is used; e.g., //www.example.com becomes http://www.example.com or https://www.example.com depending on the URL of the referring page. If a web page is saved on a local disk and then opened from there, it has no protocol (just the file: pseudo-protocol), so URLs like //www.example.com won’t work; so here’s one reason for including the “http:” or “https:” part.

Omitting also the “//” part is a completely different issue altogether, turning the URL to a relative URL that will be interpreted as relative to the current base URL.

The reason why www.example.com works when typed or pasted on a browser’s address line is that relative URLs would not make sense there (there is no base URL to relate to), so browser vendors decided to imply the “http://” prefix there.

Upvotes: 1

Muhammad Ali Bala
Muhammad Ali Bala

Reputation: 368

Add the the Href with HTTP request. Use this may help you and solve your problem

<html>
         <head>
<title>Header template</title>

<!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

      </head>
  <body>
<button class="btn btn-default">Hello World</button>
  </body>
  </html>

Upvotes: 1

Related Questions