Getting Started

OneCDN is a powerful and intelligent CDN management system that allows you to load and manage multiple libraries with a single script tag. It handles everything — from placement to fallback — automatically.

Basic Usage

To use OneCDN, simply include the following script tag in your HTML:

<script src="https://onecdn.in/[email protected]/[email protected]&[email protected]" 
    referrerpolicy="origin-when-cross-origin" 
    crossorigin="anonymous"></script>

This example loads Bootstrap 5.3.2 and jQuery 3.6.0. OneCDN automatically handles loading order, placement, and fallback — no extra configuration required.

Using the CDN Generator

To simplify the process, use our CDN Generator tool to visually select libraries, versions, and generate the appropriate snippet in seconds.

How OneCDN Works

OneCDN manages CDN loading, fallback, and script positioning behind the scenes to give you optimal performance and reliability.

The Process

  1. The script is loaded from onecdn.in.
  2. It parses the URL and determines which libraries and versions to load.
  3. OneCDN checks and selects the best CDN for each library.
  4. It dynamically injects scripts and stylesheets into the document at optimal positions.
  5. Fallback logic ensures libraries are loaded even if a CDN goes down.

Project Key Mode Beta

For authenticated users, OneCDN offers project-based configuration:

<script src="https://onecdn.in/key/[YOUR_PROJECT_KEY]" 
    referrerpolicy="origin-when-cross-origin" 
    crossorigin="anonymous"></script>

This allows you to manage all libraries and their versions through your OneCDN dashboard, with full analytics and update control.

CDN Placement Guide

OneCDN intelligently manages placement of each resource, but here's how it works under the hood:

Head vs. Body Placement

  • Head Placement: Critical CSS and libraries required before render are injected into the head.
  • Body Placement: Scripts that are not render-blocking are placed just before the closing </body> tag.

You don’t need to configure placement manually — OneCDN detects and handles this automatically.

Fallback Logic

OneCDN includes a proactive fallback system that ensures your resources are always available.

How Fallbacks Work

Behind the scenes, OneCDN monitors the health of various CDNs in real time. If a primary CDN fails, OneCDN immediately switches to a verified backup source.

// Example: Internal CDN fallback logic (abstracted)
const cdnSources = {
  'jQuery': [
    'https://code.jquery.com/jquery-{VERSION}.min.js',
    'https://cdnjs.cloudflare.com/ajax/libs/jquery/{VERSION}/jquery.min.js',
    'https://cdn.jsdelivr.net/npm/jquery@{VERSION}/dist/jquery.min.js'
  ],
  // And so on for other libraries...
};

This mechanism is automatic — no configuration or setup needed from your side.

Project Dashboard Beta

Once logged in, you can create and manage projects using your personalized OneCDN dashboard. Each project gets a unique key:

  • Customize libraries and versions per project.
  • Update libraries centrally without modifying code.
  • Access usage stats, performance logs, and error fallbacks.

To use a project key, embed your script like this:

<script src="https://onecdn.in/key/YOUR_PROJECT_KEY" 
    referrerpolicy="origin-when-cross-origin" 
    crossorigin="anonymous"></script>

Examples

Basic Example

<script src="https://onecdn.in/[email protected]/[email protected]&[email protected]" 
    referrerpolicy="origin-when-cross-origin" 
    crossorigin="anonymous"></script>

Using a Project Key Beta

<script src="https://onecdn.in/key/YOUR_PROJECT_KEY" 
    referrerpolicy="origin-when-cross-origin" 
    crossorigin="anonymous"></script>