Accessibility widget script
Required level of JavaScript Knowledge
To configure and implement the WCAG accessibility widget as a standard script, basic JavaScript knowledge is sufficient, including:
- Adding scripts to web pages.
- Creating and modifying JavaScript objects.
- Passing arguments to functions.
No advanced programming knowledge is required – the script is designed to be easy to integrate even into simple HTML pages without frameworks.
However, if you are using modern frontend technologies such as npm, React, Vue, or Svelte, we recommend installing the widget via dedicated packages:
- Installation via npm (TypeScript/JavaScript)
- Installation in React projects
- Installation in projects Vue
- Installation in projects Svelte
These methods offer additional conveniences such as hooks, providers, reactive mechanisms, and better integration with SPA applications.
Script Structure and Operation
Basic Script Framework:
<script>
(function (d, s, t) {
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s);
j.async = true;
j.src = '//wcag.dock.codes/accessibility/' + t + '/start.js';
f.parentNode.insertBefore(j, f);
})(document, 'script', '_TOKEN_');
</script>
Script Parameters:
-
'_TOKEN_'- Description: A unique token assigned to your widget.
- Required: Yes.
- You can download the token for free in your DockWCAG account.
- Example:
'abcde12345'.
Final Notes
- Before implementing, make sure your token is valid and active.
- If the widget doesn’t display after adding the script, check your browser console (F12 → “Console”).
- If you continue to have problems, visit the Troubleshooting section or contact us.