---
title: "Keep working when a script or service · Agent Wranglers"
url: https://agentwranglers.se/playbook/website/when-things-break/graceful-degradation
updated: 2026-10-20
licence: "All rights reserved"
---

# Keep working when a script or service fails

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Recommended
- Chapter: [When things break](https://agentwranglers.se/playbook/website/when-things-break)
- Rule: When a script, a font or another company's service fails at runtime, the page still shows its content and its main actions still work.
- How: Build on [progressive enhancement](https://agentwranglers.se/playbook/website/site-architecture/progressive-enhancement), so plain HTML already works. Test that a browser feature exists before using it. Load third-party scripts with `async` and a time limit, and catch their errors. Give script-only widgets a `<noscript>` text and a plain link to do the same job.
- Check: In the browser's developer tools, block each third-party domain and then the main script. Each page still shows its content and its main links, with no uncaught errors.

Example:

```html
<a href="/contact" class="open-chat">Contact us</a>
<noscript><p>The booking calendar needs JavaScript. You can also email book@example.com.</p></noscript>
<script type="module">
  if ('clipboard' in navigator) document.body.classList.add('can-copy');
  import('https://chat.example.net/widget.js').catch(() => document.body.classList.add('chat-down'));
</script>
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers website playbook: https://agentwranglers.se/playbook/website/when-things-break/graceful-degradation`.

- Previous: [Say when you'll be back](https://agentwranglers.se/playbook/website/when-things-break/maintenance-pages)
- Next: [Hide buttons that need JavaScript until it runs](https://agentwranglers.se/playbook/website/when-things-break/hide-script-only-controls)
- [When things break](https://agentwranglers.se/playbook/website/when-things-break)
