🌐
Bootstrap
getbootstrap.com › docs › 5.3 › getting-started › download
Download · Bootstrap v5.3
You’ll find the same files on these CDN providers, albeit with different URLs. With cdnjs, you can use this direct Bootstrap package link to copy and paste ready-to-use HTML snippets for each dist file from any version of Bootstrap.
People also ask

Is it Possible to use Bootstrap Offline?
Yes, it is possible to use Bootstrap offline. Download the Bootstrap files from the official website, then include the local CSS and JS files in your project. This allows you to develop without needing an internet connection.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-bootstrap
How to install Bootstrap? Download and CDN Setup Explained
When to use Bootstrap and When not to?
Use Bootstrap for projects that require a responsive, mobile-first design and quick development with pre-designed components. Avoid Bootstrap if you need a highly customised design or if your project demands lightweight code without unnecessary bloat.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-bootstrap
How to install Bootstrap? Download and CDN Setup Explained
What are the Related Courses and Blogs Provided by The Knowledge Academy?
The Knowledge Academy offers various Programming Training, including Bootstrap Training, Object Oriented Programming (OOPs) and Python with Machine Learning. These courses cater to different skill levels, providing comprehensive insights into Programming methodologies in general. Our Programming & DevOps Blogs cover a range of topics related to Bootstrap, offering valuable resources, best practices, and industry insights. Whether you are a beginner or looking to advance your Programming skills, The Knowledge Academy's diverse courses and informative blogs have you covered.
🌐
theknowledgeacademy.com
theknowledgeacademy.com › blog › install-bootstrap
How to install Bootstrap? Download and CDN Setup Explained
🌐
Bootstrap
getbootstrap.com › docs › 4.4 › getting-started › download
Download · Bootstrap
Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> If you’re using our compiled JavaScript, don’t forget to include CDN versions of jQuery and Popper.js before it.
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › getting-started › download
Download · Bootstrap v5.0
Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project. <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> If you’re using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.

web design front-end framework

Bootstrap (formerly Twitter Bootstrap) is a free and open-source CSS framework directed at responsive, mobile-first front-end web development. It contains HTML, CSS and (optionally) JavaScript-based design templates for typography, forms, buttons, navigation, … Wikipedia
Factsheet
Original authors Mark Otto, Jacob Thornton
Developer Bootstrap Core Team
Initial release August 19, 2011; 14 years ago (2011-08-19)
Factsheet
Original authors Mark Otto, Jacob Thornton
Developer Bootstrap Core Team
Initial release August 19, 2011; 14 years ago (2011-08-19)
🌐
Bootstrap
getbootstrap.com
Bootstrap · The most popular HTML, CSS, and JS library in the world.
Jump right into building with Bootstrap—use the CDN, install it via package manager, or download the source code.
🌐
BootstrapCDN
bootstrapcdn.com
Official CDN of Bootstrap and Font Awesome · BootstrapCDN
The recommended free CDN for Bootstrap, Font Awesome, Bootswatch and Bootstrap Icons.
🌐
cdnjs
cdnjs.com › home › libraries › bootstrap
bootstrap - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers
Tags: css, less, mobile-first, ... Some files are hidden, click to show all files · https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.8/js/bootstrap.min.js ·...
Find elsewhere
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › getting-started › introduction
Introduction · Bootstrap v5.0
Looking to quickly add Bootstrap to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download the source files?
🌐
The Knowledge Academy
theknowledgeacademy.com › blog › install-bootstrap
How to install Bootstrap? Download and CDN Setup Explained
We hope you read and understood How to Install Bootstrap. Bootstrap streamlines Web Development with its responsive design and pre-built components like Bootstrap Buttons. Whether using the CDN for simplicity or downloading for full control, Bootstrap enhances the aesthetics and functionality of websites.
🌐
BelugaCDN
belugacdn.com › bootstrap cdn
Bootstrap CDN Download | How to use Bootstrap 4 CDN Framework
Thankfully, you can gather much ... Content Delivery Network Speed Up Website for Free ... Download CDN Bootstrap 4 from its official website and unzip the files....
🌐
W3Schools
w3schools.com › bootstrap › bootstrap_get_started.asp
Bootstrap Get Started
If you don't want to download and host Bootstrap yourself, you can include it from a CDN (Content Delivery Network).
🌐
BootstrapDocs
bootstrapdocs.com › v3.0.0 › docs › getting-started
Getting started · Bootstrap 3.0.0 Documentation - BootstrapDocs
Get the original files for all CSS and JavaScript by downloading the latest version directly from GitHub. Clone the entire project or fork your own version of Bootstrap to make it your own by visiting us on GitHub. Install and manage the original files for all CSS and JavaScript, along with a local copy of the docs, using Bower. ... The folks over at NetDNA have graciously provided CDN ...
🌐
Bootstrap
getbootstrap.com › docs › 4.6 › getting-started › download
Download · Bootstrap v4.6
Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script> If you’re using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.
🌐
Bootstrap
getbootstrap.com › docs › 5.1 › getting-started › introduction
Introduction · Bootstrap v5.1
Looking to quickly add Bootstrap to your project? Use jsDelivr, a free open source CDN. Using a package manager or need to download the source files?
🌐
Bootstrap
getbootstrap.com › docs › 5.2 › getting-started › introduction
Get started with Bootstrap · Bootstrap v5.2
Get started by including Bootstrap’s production-ready CSS and JavaScript via CDN without the need for any build steps.
Top answer
1 of 5
237

Why Not Both ¯\(ツ)/¯ ? Scott Hanselman has a great article on using a CDN for performance gains but gracefully falling back to a local copy in case the CDN is down.

Specific to bootstrap, you can do the following to load from a CDN with a local fallback:

Working Demo in Plunker

<head>
  <!-- Bootstrap CSS CDN -->
  <link rel="stylesheet" href="~https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css">
  <!-- Bootstrap CSS local fallback -->
  <script>
    var test = document.createElement("div")
    test.className = "hidden d-none"

    document.head.appendChild(test)
    var cssLoaded = window.getComputedStyle(test).display === "none"
    document.head.removeChild(test)

    if (!cssLoaded) {
        var link = document.createElement("link");

        link.type = "text/css";
        link.rel = "stylesheet";
        link.href = "lib/bootstrap.min.css";

        document.head.appendChild(link);
    }
  </script>
</head>
<body>
    <!-- APP CONTENT -->
   
    <!-- jQuery CDN -->
    <script src="~https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
    <!-- jQuery local fallback -->
    <script>window.jQuery || document.write('<script src="lib/jquery.min.js"><\/script>')</script>

    <!-- Bootstrap JS CDN -->
    <script src="~https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <!-- Bootstrap JS local fallback -->
    <script>if(typeof($.fn.modal) === 'undefined') {document.write('<script src="lib/bootstrap.min.js"><\/script>')}</script>
</body>

Updates

  • As of 2021, all major browsers double partition http cache keys with the top level domain of the requester, so you'll no longer get a performance benefit from previous cache hits on other sites.
  • you can also do the same test using YepNope or fallback.js
  • per Flash's comment and this solution, updated answer to check for .visible class instead of testing for rgb(51, 51, 51)
  • per deste's comment, updated to use .hidden and .d-none for either Boostrap 3.x or 4
  • when testing if a stylesheet loaded, you have to look for a style that would have been applied, create an element, and see if it has been applied.
  • Updated the stylesheet to load immediately in the head by using vanilla js. You need to create a test element using Document​.create​Element(), apply bootstrap classes, use Window​.get​Computed​Style() to test for display:none, and then conditionally insert a stylesheet using js.

Best Practices

To your question on Best Practices, there are a lot of very good reasons to use a CDN in a production environment:

  1. It increases the parallelism available.
  2. It increases the chance that there will be a cache-hit.
  3. It ensures that the payload will be as small as possible. update
  4. It reduces the amount of bandwidth used by your server.
  5. It ensures that the user will get a geographically close response.

To your versioning concern, any CDN worth its weight in salt with let you target a specific version of the library so you don't accidentally introduce breaking changes with each release.

Using document.write

According to the mdn on document.write

Note: as document.write writes to the document stream, calling document.write on a closed (loaded) document automatically calls document.open, which will clear the document.

However, the usage here is intentional. The code needs to be executed before the DOM is fully loaded and also in the correct order. If jQuery fails, we need to inject it into the document inline before we attempt to load bootstrap, which relies on jQuery.

HTML Output After Load:

In both of these instances though, we're calling while the document is still open so it should inline the contents, rather than replacing the entire document. If you're waiting till the end, you'll have to replace with document.body.appendChild to insert dynamic sources.

Aside: In MVC 6, you can do this with link and script tag helpers

2 of 5
13

Depends on the specific site.

Do you have many users? Do you care about bandwidth usage? Is performance an issue (CDN's can speed up the responses) ?

You can link to a specific version:

//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css

Or

//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css

That way you don't have to worry about library updates, its a better practice to keep updated.

I am not sure what are the exact statistics about developers choice, but you can have a look here and see Billions of requests are sent to Bootstrap CDN, which means it is robust and safe to use.

🌐
Bootstrap
getbootstrap.com › docs › 5.3 › getting-started › introduction
Get started with Bootstrap · Bootstrap v5.3
Get started by including Bootstrap’s production-ready CSS and JavaScript via CDN without the need for any build steps.
🌐
Bootstrap Table
bootstrap-table.com › docs › getting-started › download
Download · Bootstrap Table
Download Bootstrap Table to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, yarn, and more. ... Source CSS, JavaScript, locales, and extensions, along with our docs. Download source ... The folks over at CDNJS graciously provide CDN support for CSS and JavaScript of Bootstrap table.