An app that looks fine but its buttons do nothing

A page that renders but whose buttons, sliders and links do nothing is usually a page whose JavaScript never ran. The HTML was already on the page — pre-rendered at build time or server-rendered — so it looks complete. The script that makes it interactive was not loaded, or was loaded as the wrong kind of file.

What it looks like

1. Read the console first

Open the browser's developer tools and look at the console. "Unexpected token" is the parser saying it met something it cannot read at that position (MDN: SyntaxError: Unexpected token, checked 2026-11-06). When the first character of the file is <, the browser was handed an HTML document where it expected JavaScript — for example the site's 404 page or the home page.

The error names the script, not the bug. The bug is on the server, in whatever answered that request.

2. Ask the server what it returned for the script

Take the script's URL from the error or from the Network tab, then request it directly:

curl -I https://example.com/assets/app-abc123.js

Read two things in the response:

If the response has X-Content-Type-Options: nosniff, a script served with an HTML type is blocked before it is even parsed; without that header the browser tries to parse the HTML as JavaScript and fails at the first character (MDN: X-Content-Type-Options, checked 2026-11-06).

3. Find the rule that did it

The usual causes, in order of how often they turn up:

  1. A single-page-app fallback. Every path the static server cannot find is answered with index.html. That is right for page URLs such as /plans and wrong for /assets/app-abc123.js.
  2. A redirect for old or moved pages. A rule written for a page path that no longer exists can match a folder of the same name. A rule for /assets or /static then catches every file under it.
  3. The file is simply missing from the host, and the fallback from point 1 hides the miss behind a 200 page.

Match rules against the whole path, not just the first segment: /assets/app.js is both "under /assets" and "a file", and the second fact must win.

4. Fix it at the server, not in the app

The same rule applies in reverse proxies, CDN rules and serverless rewrites: the asset path has to be excluded from the catch-all before it is excluded from anything else.

5. Check that it is fixed

Why the page looked fine all along

Pre-rendering — turning each page into static HTML at build time — is there for speed and for search engines, and it does its job even when the JavaScript is broken. The markup arrives complete, so the page paints. Only interaction shows the difference.

Pre-rendered markup can also show browser defaults where an app value belongs. A range input with no value attribute shows the halfway point between its minimum and maximum (MDN: <input type="range">, checked 2026-11-06); a slider parked in the middle while the page around it says something else is a second clue that no script has run.

See also

Glossary terms used on this page: Host, Serverless, Token, Tool.

Sources

All checked on 2026-11-06.


First version written with AI assistance, from a deployment bug where a redirect rule for retired pages also matched the folder that holds the site's JavaScript, and checked against the sources on 2026-11-06. Found a mistake? Fix it or open an issue. Text licensed under CC BY 4.0.