Skip to main content

Installation

A11yCore offers two installation methods: the modernESM bundle(recommended) for optimal performance, or thelegacy script tagfor maximum compatibility.

97% Smaller Initial Load

The ESM bundle is only~14KBcompared to 522KB for the legacy bundle. Features load on-demand as users interact with them, dramatically improving page load times.

ESM Installation

Add this module script to your page. The ESM bundle uses modern JavaScript imports and loads features on-demand.

HTML (ESM)
<script type="module">
  import A11yCore from 'https://cdn.a11ycore.org/a11ycore/dist/esm/core.js';
  
  A11yCore.init({ licenseKey: 'YOUR_LICENSE_KEY' });
</script>

With Configuration

Use async/await for more control over initialization and configuration:

HTML (ESM with config)
<script type="module">
  // Async/await pattern for more control
  import A11yCore from 'https://cdn.a11ycore.org/a11ycore/dist/esm/core.js';
  
  await A11yCore.init({
    licenseKey: 'YOUR_LICENSE_KEY',
    config: {
      widget: { position: 'bottom-right' }
    }
  });
  
  console.log('A11yCore initialized!');
</script>

ESM Bundle Options

BundleSizeUse Case
/esm/core.js~14KBLightweight core with on-demand feature loading (recommended)
/esm/index.js~27KBFull API with all feature references

Script Attributes

AttributeRequiredDescription
data-keyYesYour license key from the A11yCore dashboard. Required for license verification.
data-configNoURL to a JSON configuration file for remote config loading.
data-debugNoSet to "true" to enable console logging for debugging.
data-autoinitNoSet to "false" to disable auto-initialization. Use with manual init.
deferRecommendedDefers script execution until DOM is ready. Prevents render blocking.

Subresource Integrity (SRI)

For enhanced security, add theintegrityattribute with the SHA-384 hash from your dashboard. The browser will verify the script hasn't been tampered with.

HTML with SRI
<script
  src="https://cdn.a11ycore.org/a11ycore/dist/v1/a11ycore.min.js"
  data-key="YOUR_LICENSE_KEY"
  integrity="sha384-[HASH_FROM_DASHBOARD]"
  crossorigin="anonymous"
  defer
></script>

How Auto-Initialization Works

When the script loads, A11yCore automatically:

  1. Waits for the DOM to be ready (DOMContentLoadedorreadyState === 'interactive')
  2. Reads thedata-keyattribute from the script tag
  3. Verifies your license with the A11yCore server
  4. Starts a MutationObserver to scan for accessibility issues
  5. Initializes the accessibility widget UI
  6. Sets up keyboard shortcut handlers (default:Alt+A)

License Key Required

Without a valid license key, A11yCore displays a watermark and some features may be limited. Get your key from thedashboardafter signing up.