Support

Find answers, guides, and tutorials to supercharge your content delivery.

Using a Knockout CDN Combination

Updated on October 4, 2018
Using a Knockout CDN Combination

What is Knockout?

Knockout is a popular open source JavaScript library which helps create responsive and rich web applications. It is quite useful when your web application has UI sections that update dynamically as Knockout can help implement such functionality more simply and maintainably. A few key components of Knockout.js include:

  • Declarative bindings: An easy way to connect your DOM elements to your data model.
  • Automatic UI refresh: If there is a change in your data model's state, your UI will update automatically.
  • Dependancy tracking: Set up chains of relationships between model data.
  • Templating: Generate nested UIs as a function of your model data.

Knockout can be downloaded and hosted on your origin server, however it can also be referenced using a Handlebars CDN combination for faster and more reliable delivery. The following section outlines two methods for referencing Knockout.js with a CDN in your web project.

How to use a Knockout CDN combination

The Knockout.js library can quickly be referenced using your own CDN URL if you already have an existing CDN account. For those who do not currently have a CDN account, the library can also be referenced using a third party CDN service.

Option 1 - Using your own CDN account

For those who already have a CDN account, it can be used to help speed up the delivery of the Knockout.js library. If you're using KeyCDN as your CDN provider, two Zone options are available:

Upon client request, a Pull Zone will automatically pull static content from your origin server and cache it at the visitor's nearest point of presence (POP). Therefore, now that the assets are cached, upon subsequent requests they are delivered from the CDN edge server instead of the origin server. With this method, no URL configuration is necessary within your HTML, simply integrate your site with one of our CDN integration options.

For Push Zone users, simply upload the latest version of Knockout via FTP(S) or rsync and reference it in your project using either your Zone URL (e.g. example-hexid.kxcdn.com/js/knockout-min.js) or Zone Alias (e.g. cdn.example.com/js/knockout-min.js)

Option 2 - Using an open source CDN

If you do not have a CDN account but would still like to use a Knockout CDN combination, you may use an open source CDN service such as cdnjs.com. To reference cdnjs Knockout use following snippet (ensure that you first check for the latest version x.y.z).

<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/x.y.z/knockout-min.js"></script>

Benefits of a Knockout CDN combination

Using a Knockout CDN combination is especially beneficial for improving load times as there will be less distance to travel between the client and server. Making use of a CDN also helps improves redundancy and security for your static files and is beneficial for the SEO of your entire site. For CDN users who accelerate their static assets with KeyCDN there also exist many other advantages such as:

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more