JavaScript errors happen in your visitors' browsers, so your server never sees them. To find them, open the page, press F12 (or right-click → Inspect) and choose the Console tab. Each red error shows the type of error, a message, and the file and line where it happened. An "uncaught" error is one nothing in the code handled, and it usually stops the rest of that script from running, which is why buttons, forms or whole pages stop working.
What's the problem
Something on the page doesn't work (a button, a menu, a form, a whole section), and the browser console shows red errors such as Uncaught TypeError or Uncaught ReferenceError.
Why it happens
- Code expects something that isn't there: data that didn't load, an element not on the page, a variable that's undefined. See Cannot read property of undefined.
- A script failed to load, so code that depends on it breaks. See script not loading.
- A recent change introduced a bug.
- A third-party script (chat widget, analytics, ads) throws errors.
- Browser differences: code using features an older browser doesn't support.
How to fix it
- Open the console and reload the page so you see errors from the start.
- Read the first error, not the last. Later errors are often caused by the first.
- Click the file name and line to see the exact code.
- Note the error type: TypeError, ReferenceError and SyntaxError each have their own common causes; MDN's error reference explains each.
- Check recent changes to that file.
- Add error tracking so you hear about errors your visitors hit, not just the ones you see.
What Preventionlabs checks
One click runs the full report on your domain. For this problem it shows whether your site loads, how fast, and where its redirects go; script libraries on your homepage with published security holes; every outside service your homepage loads scripts and files from. With Cloudflare connected, it also shows recent deploys and account changes, with their times. It doesn't run your pages in a browser, so open the browser console on the failing page to see the error itself.
Run your free reportYour first report is free, no card needed. Then A$50 a month, up to 10 domains. Read-only: it never changes anything.
Sources
- MDN Web Docs: JavaScript error referencereference
Below, you'll find a list of errors which are thrown by JavaScript.
- MDN Web Docs: JavaScript error referencereference
Errors displayed in the Web console may include a link to the corresponding page below to help you quickly comprehend the problem in your code.