Discover how to diagnose slow websites, identify JavaScript errors, optimize loading performance, improve accessibility, investigate technical SEO, and build faster, more reliable web applications through practical examples and hands-on projects.
Your Website Works. But Is It Working Well?
You build a website, publish it, and everything appears to be working.
The pages load. The navigation works. Images appear. Forms respond.
But then you notice something unexpected.
Visitors leave before exploring your content.
Some pages load quickly on your computer but feel sluggish on mobile devices.
Buttons occasionally stop responding.
Your website looks fine, yet search engines struggle to discover certain pages.
A new JavaScript feature introduces errors that weren’t present before.
Or a recent update makes the site noticeably slower.
These are common challenges in modern web development.
A website can be functional without being fast, accessible, reliable, or optimized for search engines.
Understanding the difference is essential.
That’s why I’ve created the Web Diagnostics & Performance Academy, a free DiscoveryVIP learning resource focused on understanding website behavior, investigating problems, and improving real-world performance.
Explore the Academy:
https://discoveryvip.com/web-diagnostics-performance-academy

In this article, we’ll examine the fundamentals of web diagnostics, explore browser developer tools, learn how to measure performance, investigate common problems, and build a practical JavaScript diagnostics dashboard.
You’ll also discover how AI can support performance analysis and troubleshooting, along with project ideas and a 14-day website optimization challenge.
1. What Is Web Diagnostics?
Web diagnostics is the process of investigating how a website behaves, identifying problems, understanding their causes, and determining how to correct them.
It includes several interconnected areas.
| Diagnostic area | What you investigate |
|---|---|
| Performance | Loading speed, rendering, responsiveness |
| JavaScript | Runtime errors, exceptions, long tasks |
| Network | Requests, response codes, resource sizes |
| HTML | Structure, semantics, document validity |
| CSS | Layout problems, rendering, responsiveness |
| Accessibility | Keyboard navigation, labels, contrast |
| Technical SEO | Metadata, indexing, canonical URLs |
| Security | HTTPS, headers, unsafe dependencies |
| Reliability | Failed requests, broken functionality |
| User experience | Responsiveness, visual stability, usability |
A useful diagnostic process answers four questions:
- What is happening?
- Why is it happening?
- What should be changed?
- Did the change actually improve the result?
The final question is especially important.
An optimization is not successful simply because the code looks cleaner.
It should produce a measurable improvement without breaking existing functionality.
2. Understand How Browsers Load Websites
Before optimizing a website, it helps to understand what happens when someone visits a page.
A simplified loading process looks like this:
User Enters URL
↓
DNS Resolution
↓
Connection Establishment
↓
HTTP Request
↓
HTML Response
↓
HTML Parsing
↓
CSS and JavaScript Discovery
↓
Resource Loading
↓
DOM and CSSOM Construction
↓
Layout and Paint
↓
Page Becomes Interactive
Real browsers perform many of these activities concurrently, and JavaScript can alter the sequence.
Each stage can introduce delays.
Example: A Slow Page
Imagine a page containing:
- A large hero image
- Several external stylesheets
- Multiple JavaScript libraries
- A third-party analytics script
- Custom fonts
- Embedded videos
Even if the HTML document is small, the browser may need to download and process many additional resources.
A slow page might result from one large resource or from the combined effect of dozens of smaller ones.
The First Diagnostic Principle
Investigate before optimizing.
Don’t assume that JavaScript is the problem, that images are the problem, or that the server is the problem.
Measure the actual behavior.
3. Core Web Vitals: Three Important Performance Metrics
Google’s Core Web Vitals focus on three aspects of user experience.
Largest Contentful Paint (LCP)
LCP measures when the largest eligible content element in the viewport is rendered.
It is commonly used to assess perceived loading performance.
Interaction to Next Paint (INP)
INP measures responsiveness by observing interactions and the time until the next visual update.
It helps identify pages that feel unresponsive when users click, tap, or type.
Cumulative Layout Shift (CLS)
CLS measures unexpected visual movement.
For example, a user might attempt to click a button just as an image loads and pushes the button downward.
That is a layout stability problem.
Recommended Core Web Vitals Thresholds
<escape>| Metric | Good | Needs improvement | Poor |
|—|—|—|—|
| LCP | ≤ 2.5 seconds | > 2.5 to 4 seconds | > 4 seconds |
| INP | ≤ 200 ms | > 200 to 500 ms | > 500 ms |
| CLS | ≤ 0.1 | > 0.1 to 0.25 | > 0.25 |</escape>
These thresholds are typically assessed at the 75th percentile of page visits, separately for mobile and desktop.
Why These Metrics Matter
A page might load its HTML quickly but take several seconds to display meaningful content.
Another page might appear immediately but respond slowly to user interactions.
A third might render quickly but shift around as images and advertisements load.
Each represents a different performance problem.
Optimizing one metric does not automatically improve the others.
4. Diagnose Website Performance with Chrome DevTools
Browser developer tools are among the most useful resources available to web developers.
In Chrome, open DevTools using the browser menu or the appropriate keyboard shortcut.
Several panels are particularly valuable.
Network Panel
Use the Network panel to investigate:
- Failed requests
- HTTP response codes
- Resource sizes
- Download timing
- Caching behavior
- Slow APIs
- Request waterfalls
Performance Panel
Use the Performance panel to investigate:
- Main-thread activity
- Long JavaScript tasks
- Rendering work
- Layout calculations
- User interactions
- Performance bottlenecks
Console
Use the Console to investigate:
- JavaScript errors
- Warnings
- Failed requests
- Debugging messages
- Unexpected values
Elements Panel
Use Elements to investigate:
- DOM structure
- CSS rules
- Computed styles
- Layout dimensions
- Responsive design problems
Lighthouse
Lighthouse provides automated audits covering performance, accessibility, best practices, and SEO.
Its results are useful diagnostic signals, but they are not a complete substitute for real-user measurements or manual testing.
Practical Exercise
Open a website in Chrome.
- Open DevTools.
- Select the Network panel.
- Reload the page.
- Sort resources by transferred size.
- Identify the largest resources.
- Look for failed requests.
- Examine the timing of the slowest requests.
- Repeat with simulated network throttling.
Record your observations before making changes.
5. Measure Page Loading with the Performance API
JavaScript provides built-in APIs for measuring performance.
One of the most useful is the Performance API.
Example: Navigation Timing
const navigation = performance
.getEntriesByType("navigation")[0];
if (navigation) {
console.table({
dnsMs:
navigation.domainLookupEnd -
navigation.domainLookupStart,
connectionMs:
navigation.connectEnd -
navigation.connectStart,
responseMs:
navigation.responseEnd -
navigation.responseStart,
domContentLoadedMs:
navigation.domContentLoadedEventEnd -
navigation.startTime,
loadEventMs:
navigation.loadEventEnd -
navigation.startTime
});
}
Run this in the browser console after the page has loaded.
Understanding the Results
DNS time measures the time spent resolving the domain when a lookup is needed.
Connection time reflects connection establishment where applicable.
Response time measures the interval from the start of the response to the end of the response.
DOMContentLoaded indicates when the initial HTML document has been parsed and deferred scripts have executed.
Load event timing reflects the page’s load event, which waits for certain dependent resources.
These measurements are useful, but they don’t directly represent every aspect of perceived performance.
For example, a page may fire its load event before an important application component finishes rendering.
Measure Custom Operations
performance.mark("task-start");
const numbers = Array.from(
{ length: 100000 },
(_, index) => index
);
const total = numbers.reduce(
(sum, value) => sum + value,
0
);
performance.mark("task-end");
performance.measure(
"calculation-duration",
"task-start",
"task-end"
);
const measurement = performance
.getEntriesByName(
"calculation-duration",
"measure"
)[0];
console.log({
total,
durationMs: measurement.duration
});
Custom measurements help you understand how long specific operations take.
6. Find and Fix JavaScript Performance Problems
JavaScript is essential for interactive applications, but inefficient code can block the browser’s main thread.
When the main thread is busy, the browser may struggle to respond promptly to user input.
Example: Inefficient DOM Updates
const container = document.querySelector(
"#results"
);
for (let i = 0; i < 1000; i++) {
container.innerHTML += `<p>Item ${i}</p>`;
}
Repeatedly modifying innerHTML can cause unnecessary parsing and DOM replacement.
It may also remove existing event listeners attached to replaced descendants.
Improved Approach
const container = document.querySelector(
"#results"
);
const fragment = document.createDocumentFragment();
for (let i = 0; i < 1000; i++) {
const paragraph = document.createElement("p");
paragraph.textContent = `Item ${i}`;
fragment.appendChild(paragraph);
}
container.replaceChildren(fragment);
This creates elements before inserting them into the live document.
It also avoids interpreting generated strings as HTML.
Why This Is Better
- Reduces repeated DOM replacement
- Makes text insertion safer
- Preserves clearer separation between data and markup
- Provides a more maintainable implementation
The actual performance difference depends on the browser and workload.
Measure both implementations rather than assuming the improvement is always significant.
7. Optimize Images Without Sacrificing Quality
Images are often among the largest resources on a webpage.
A single oversized image can significantly affect loading performance.
Example: Unoptimized Image
<img src="large-banner.jpg" alt="Learning dashboard">
The browser may download a much larger image than necessary.
Improved Responsive Image
<img
src="banner-800.webp"
srcset="
banner-480.webp 480w,
banner-800.webp 800w,
banner-1200.webp 1200w
"
sizes="
(max-width: 600px) 100vw,
800px
"
width="1200"
height="675"
alt="Learning dashboard showing course progress"
>
The browser can choose an appropriate resource based on the viewport and device characteristics.
The files referenced in srcset must exist and should contain appropriately sized versions of the same image.
Lazy Loading
For images below the initial viewport:
<img
src="lesson-preview.webp"
loading="lazy"
width="640"
height="360"
alt="Preview of a JavaScript lesson"
>
Lazy loading can reduce unnecessary initial network activity.
However, avoid automatically lazy-loading the main hero image if it is likely to be the LCP element.
Prioritize Important Images
<img
src="hero.webp"
fetchpriority="high"
width="1200"
height="675"
alt="Web performance dashboard"
>
Use high fetch priority selectively for important resources.
Overusing priority hints can reduce their effectiveness.
Image Optimization Checklist
- Use appropriate dimensions.
- Compress images.
- Consider modern formats such as WebP or AVIF.
- Use responsive image variants.
- Specify intrinsic dimensions.
- Lazy-load suitable offscreen images.
- Prioritize critical above-the-fold content.
- Verify image quality after compression.
8. Prevent Layout Shifts
Unexpected layout movement creates a frustrating user experience.
Consider an image without reserved dimensions.
<img src="course-banner.jpg" alt="Course banner">
If the browser does not know how much space the image requires, surrounding content may move when the image loads.
Reserve Image Space
<img
src="course-banner.jpg"
width="1200"
height="675"
alt="Course banner"
>
Add responsive styling:
img {
max-width: 100%;
height: auto;
}
The browser can calculate the expected aspect ratio before the image finishes loading.
Other Causes of Layout Shifts
- Advertisements inserted without reserved space
- Dynamically loaded widgets
- Font substitutions
- Images without dimensions
- Content inserted above existing content
- Animations that change layout properties
Better Animation Techniques
Prefer animating transform and opacity where appropriate.
.card {
transition:
transform 200ms ease,
opacity 200ms ease;
}
.card:hover {
transform: translateY(-4px);
}
This can avoid unnecessary layout recalculation compared with animating positional layout properties.
9. Diagnose Network Requests and API Performance
A webpage can appear slow because its backend services respond slowly.
Use the Network panel to inspect request timing.
Example: Measure an API Request
async function loadData() {
const startedAt = performance.now();
try {
const response = await fetch("/api/data");
if (!response.ok) {
throw new Error(
`HTTP ${response.status}`
);
}
const data = await response.json();
return data;
} finally {
const duration =
performance.now() - startedAt;
console.log(
`Request duration: ${duration.toFixed(1)} ms`
);
}
}
This measures the elapsed time for the request and JSON processing inside the function.
Investigate Slow Requests
Ask:
- Is the server slow to respond?
- Is the response unnecessarily large?
- Are requests being repeated?
- Is caching configured appropriately?
- Are multiple requests waiting on one another?
- Is the API doing expensive database work?
- Can independent requests run concurrently?
Parallel Requests
If two requests are independent:
const [courses, students] = await Promise.all([
fetch("/api/courses").then(response => {
if (!response.ok) {
throw new Error("Courses request failed");
}
return response.json();
}),
fetch("/api/students").then(response => {
if (!response.ok) {
throw new Error("Students request failed");
}
return response.json();
})
]);
This can reduce total waiting time compared with executing independent requests sequentially.
However, excessive concurrency can overwhelm servers.
Choose an appropriate level of parallelism.
10. Understand Caching and Repeat Visits
Caching allows browsers and other systems to reuse previously retrieved resources.
This can improve performance significantly.
Common Cacheable Resources
- Stylesheets
- JavaScript bundles
- Images
- Fonts
- Versioned static assets
Example Cache Header
Cache-Control: public, max-age=31536000, immutable
This can be appropriate for versioned static assets whose URLs change whenever their contents change.
It is generally not appropriate for frequently updated HTML pages using stable URLs.
Why Versioning Matters
Suppose your stylesheet is named:
styles.css
If you configure long-term caching but later change the file without changing its URL, returning visitors may continue using the old version.
A versioned filename avoids this problem:
styles.a83f2c.css
Practical Investigation
Open DevTools and compare:
- First visit with an empty cache.
- Repeat visit with caching enabled.
- Reload after changing a resource.
- Observe which resources are transferred again.
Caching is one of the most effective optimizations for repeat visitors when configured correctly.
11. Diagnose CSS and Rendering Performance
CSS can affect rendering performance as well as visual design.
Complex pages may spend significant time calculating styles, laying out elements, and painting pixels.
Common Issues
- Large, complex DOM trees
- Frequent layout changes
- Expensive visual effects
- Repeated style recalculation
- Layout thrashing
- Animations affecting layout
Layout Thrashing Example
const boxes = document.querySelectorAll(
".box"
);
boxes.forEach(box => {
const width = box.offsetWidth;
box.style.width = `${width + 10}px`;
});
This interleaves layout reads and writes.
Depending on the page, the browser may need to perform repeated layout work.
Improved Approach
const boxes = [
...document.querySelectorAll(".box")
];
const widths = boxes.map(
box => box.offsetWidth
);
boxes.forEach((box, index) => {
box.style.width = `${widths[index] + 10}px`;
});
Separating reads from writes can reduce unnecessary layout recalculation.
Use the Performance panel to determine whether layout work is actually a bottleneck.
12. Accessibility Is Part of Website Quality
A fast website is not necessarily an accessible website.
Accessibility ensures that people with different abilities and assistive technologies can use the content.
Common Accessibility Problems
- Missing form labels
- Images without meaningful alternative text
- Insufficient color contrast
- Poor keyboard navigation
- Missing focus indicators
- Incorrect heading structure
- Non-semantic interactive elements
- Inaccessible error messages
Example: Poorly Labeled Form
<input type="email" placeholder="Email">
The placeholder is not a substitute for a proper label.
Improved Version
<label for="email">Email address</label>
<input
id="email"
name="email"
type="email"
autocomplete="email"
required
>
Keyboard Focus
:focus-visible {
outline: 3px solid #2563eb;
outline-offset: 3px;
}
Visible focus helps keyboard users understand which element is active.
Accessibility Testing
Use automated tools to identify common issues, then perform manual checks.
Try navigating the entire page using only the keyboard.
Check whether:
- All important controls are reachable.
- Focus order is logical.
- Focus is visible.
- Buttons have meaningful names.
- Form errors are understandable.
- Dialogs and menus behave correctly.
Automated accessibility checks are valuable, but they cannot establish complete accessibility on their own.
13. Technical SEO Diagnostics
Search engine optimization involves more than keywords.
Search engines must be able to discover, crawl, and understand your content.
Important Technical SEO Elements
- Unique page titles
- Useful meta descriptions
- Appropriate heading structure
- Canonical URLs
- Internal linking
- XML sitemaps
- Robots directives
- Mobile usability
- Structured data where appropriate
- Accessible, crawlable content
Example Metadata
<title>
Web Diagnostics & Performance Academy |
DiscoveryVIP
</title>
<meta
name="description"
content="Learn website performance diagnostics, Core Web Vitals, JavaScript debugging, accessibility, and technical SEO."
>
<link
rel="canonical"
href="https://discoveryvip.com/web-diagnostics-performance-academy/"
>
The canonical URL should identify the preferred version of the page.
Common SEO Problems
Duplicate titles: Multiple pages use the same generic title.
Missing descriptions: Search snippets may lack useful context.
Broken internal links: Visitors and crawlers encounter unavailable pages.
Incorrect canonical URLs: Pages point to an unintended preferred URL.
Blocked resources: Important content may be inaccessible to crawlers.
Thin content: Pages provide little useful information.
Poor mobile usability: Content is difficult to read or interact with on smaller screens.
Important Distinction
A strong Lighthouse SEO score does not guarantee high search rankings.
Search visibility also depends on content quality, relevance, indexing, competition, links, and other factors.
Technical SEO helps remove barriers to discovery.
14. Build a Complete Website Diagnostics Dashboard with JavaScript
Let’s create a practical application that measures several browser-observable performance characteristics.
We’ll build a single-file diagnostics dashboard.
It will:
- Display navigation timing information.
- Count loaded resources.
- Identify the largest observable resources.
- Record JavaScript errors occurring after monitoring begins.
- Display browser connection information where available.
- Run simple page-quality checks.
- Measure a custom JavaScript operation.
- Refresh the report on demand.
This project uses browser APIs and does not require an external library.
Create index.html
Copy the following code into a file named index.html.
For the most representative results, serve it through a local development server rather than opening it directly with a file:// URL.
For example:
python3 -m http.server 8000
Then open:
http://localhost:8000
Complete Source Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width, initial-scale=1"
>
<title>Web Diagnostics Dashboard</title>
<meta
name="description"
content="A practical browser-based website diagnostics dashboard."
>
<style>
:root {
font-family: system-ui, sans-serif;
color-scheme: light;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
background: #f3f6fb;
color: #172033;
line-height: 1.5;
}
main {
width: min(1100px, 94%);
margin: 40px auto;
}
h1 {
font-size: clamp(2rem, 4vw, 3rem);
margin-bottom: 8px;
}
.intro {
color: #536176;
}
.actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
margin: 24px 0;
}
button {
background: #2358c7;
color: white;
border: 0;
border-radius: 10px;
padding: 12px 18px;
font: inherit;
cursor: pointer;
}
button:hover {
background: #194399;
}
button:focus-visible {
outline: 3px solid #f59e0b;
outline-offset: 3px;
}
.grid {
display: grid;
grid-template-columns:
repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
}
.card {
background: white;
border: 1px solid #dce4f0;
border-radius: 14px;
padding: 22px;
box-shadow: 0 5px 18px
rgba(0, 0, 0, 0.04);
}
.metric {
font-size: 2rem;
font-weight: 800;
color: #2358c7;
}
.label {
color: #536176;
}
section {
margin-top: 28px;
}
.table-wrap {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th,
td {
padding: 12px;
border-bottom: 1px solid #e2e8f0;
text-align: left;
overflow-wrap: anywhere;
}
th {
background: #edf2fa;
}
.pass {
color: #166534;
}
.warning {
color: #92400e;
}
.note {
font-size: 0.9rem;
color: #536176;
}
</style>
</head>
<body>
<main>
<header>
<h1>Web Diagnostics Dashboard</h1>
<p class="intro">
Explore browser performance metrics,
resource loading, JavaScript errors,
and basic page-quality checks.
</p>
</header>
<div class="actions">
<button id="refresh">
Refresh Diagnostics
</button>
<button id="benchmark">
Run JavaScript Benchmark
</button>
</div>
<p id="status" role="status" aria-live="polite"></p>
<div class="grid">
<div class="card">
<div class="label">DOMContentLoaded</div>
<div class="metric" id="domTime">—</div>
</div>
<div class="card">
<div class="label">Load Event</div>
<div class="metric" id="loadTime">—</div>
</div>
<div class="card">
<div class="label">Observed Resources</div>
<div class="metric" id="resources">—</div>
</div>
<div class="card">
<div class="label">Captured Errors</div>
<div class="metric" id="errors">0</div>
</div>
<div class="card">
<div class="label">Benchmark Duration</div>
<div class="metric" id="benchmarkTime">—</div>
</div>
<div class="card">
<div class="label">Connection Type</div>
<div class="metric" id="connection">—</div>
</div>
</div>
<section class="card">
<h2>Largest Observable Resources</h2>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Resource</th>
<th>Type</th>
<th>Transfer Size</th>
<th>Duration</th>
</tr>
</thead>
<tbody id="resourceTable"></tbody>
</table>
</div>
<p class="note">
Resource sizes may be unavailable for
cross-origin resources or cached requests.
</p>
</section>
<section class="card">
<h2>Page Quality Checks</h2>
<ul id="checks"></ul>
</section>
<section class="card">
<h2>Captured JavaScript Errors</h2>
<ul id="errorList"></ul>
<p class="note">
Errors are captured only after the
monitoring script starts.
</p>
</section>
</main>
<script>
const capturedErrors = [];
const $ = selector =>
document.querySelector(selector);
function formatMs(value) {
return Number.isFinite(value)
? `${value.toFixed(1)} ms`
: "Unavailable";
}
function formatBytes(value) {
if (!value) {
return "Unavailable / cached";
}
return `${(value / 1024).toFixed(1)} KB`;
}
function setText(selector, value) {
$(selector).textContent = value;
}
function captureError(message) {
capturedErrors.push(message);
renderErrors();
}
window.addEventListener("error", event => {
captureError(
event.message || "Unknown script error"
);
});
window.addEventListener(
"unhandledrejection",
event => {
captureError(
`Unhandled promise rejection: ${
String(event.reason)
}`
);
}
);
function renderErrors() {
setText("#errors", capturedErrors.length);
const list = $("#errorList");
list.replaceChildren();
if (capturedErrors.length === 0) {
const item = document.createElement("li");
item.textContent =
"No errors captured since monitoring began.";
list.appendChild(item);
return;
}
capturedErrors.forEach(message => {
const item = document.createElement("li");
item.textContent = message;
list.appendChild(item);
});
}
function getNavigationMetrics() {
const navigation = performance
.getEntriesByType("navigation")[0];
if (!navigation) {
return;
}
setText(
"#domTime",
formatMs(
navigation.domContentLoadedEventEnd -
navigation.startTime
)
);
setText(
"#loadTime",
formatMs(
navigation.loadEventEnd -
navigation.startTime
)
);
}
function renderResources() {
const resources = performance
.getEntriesByType("resource");
setText("#resources", resources.length);
const largest = [...resources]
.sort(
(a, b) =>
b.transferSize - a.transferSize
)
.slice(0, 10);
const table = $("#resourceTable");
table.replaceChildren();
for (const resource of largest) {
const row = document.createElement("tr");
const values = [
resource.name,
resource.initiatorType || "other",
formatBytes(resource.transferSize),
formatMs(resource.duration)
];
values.forEach(value => {
const cell = document.createElement("td");
cell.textContent = value;
row.appendChild(cell);
});
table.appendChild(row);
}
}
function renderConnection() {
const connection =
navigator.connection ||
navigator.mozConnection ||
navigator.webkitConnection;
setText(
"#connection",
connection?.effectiveType || "Unavailable"
);
}
function runChecks() {
const checks = [];
checks.push({
name: "Page title",
passed: Boolean(document.title.trim())
});
checks.push({
name: "Meta description",
passed: Boolean(
document.querySelector(
'meta[name="description"]'
)?.content.trim()
)
});
checks.push({
name: "Main landmark",
passed: Boolean(
document.querySelector("main")
)
});
checks.push({
name: "Primary heading",
passed: Boolean(
document.querySelector("h1")
)
});
const images = [
...document.querySelectorAll("img")
];
checks.push({
name: "Images have alt attributes",
passed: images.every(
image => image.hasAttribute("alt")
)
});
const list = $("#checks");
list.replaceChildren();
checks.forEach(check => {
const item = document.createElement("li");
item.className =
check.passed ? "pass" : "warning";
item.textContent =
`${check.passed ? "PASS" : "REVIEW"}: ${
check.name
}`;
list.appendChild(item);
});
}
function runBenchmark() {
const startedAt = performance.now();
let total = 0;
for (let i = 0; i < 1000000; i++) {
total += Math.sqrt(i);
}
const duration =
performance.now() - startedAt;
setText(
"#benchmarkTime",
formatMs(duration)
);
setText(
"#status",
`Benchmark completed. Result: ${
total.toFixed(0)
}`
);
}
function refreshDiagnostics() {
getNavigationMetrics();
renderResources();
renderConnection();
runChecks();
renderErrors();
setText(
"#status",
"Diagnostics refreshed."
);
}
$("#refresh").addEventListener(
"click",
refreshDiagnostics
);
$("#benchmark").addEventListener(
"click",
runBenchmark
);
window.addEventListener(
"load",
refreshDiagnostics
);
renderErrors();
</script>
</body>
</html>
How the Dashboard Works
Navigation timing: Uses the Performance API to display page loading milestones.
Resource analysis: Lists resource timing entries visible to the browser and their reported transfer sizes.
Error monitoring: Captures JavaScript errors and unhandled promise rejections after monitoring begins.
Connection information: Displays an estimated connection type when the browser exposes that information.
Quality checks: Examines basic document structure and metadata.
JavaScript benchmark: Measures the execution time of a sample calculation.
Important Limitations
This dashboard is an educational diagnostic tool, not a replacement for Lighthouse, WebPageTest, or a complete real-user monitoring platform.
It does not calculate official Core Web Vitals.
The resource list may omit entries because of browser timing buffer limits, and cross-origin timing details may be restricted.
The benchmark measures a synthetic calculation and should not be interpreted as an overall website performance score.
The accessibility checks identify only a few structural conditions. For example, the presence of an alt attribute does not guarantee that its text is appropriate.
Extend the Project
Try adding:
- LCP observation
- CLS tracking
- INP monitoring through an established library
- Long-task detection
- Exportable JSON reports
- Historical measurement comparisons
- Performance budget warnings
- Broken-link testing
- Image dimension analysis
- AI-assisted diagnostic recommendations
These extensions turn a simple learning project into a more sophisticated diagnostics application.
15. Monitor Core Web Vitals with the web-vitals Library
For real-user Core Web Vitals measurements, Google’s web-vitals library is a practical starting point.
Install it in a modern JavaScript project:
npm install web-vitals
Then import the metrics:
import {
onLCP,
onINP,
onCLS
} from "web-vitals";
function reportMetric(metric) {
console.log({
name: metric.name,
value: metric.value,
rating: metric.rating,
id: metric.id
});
}
onLCP(reportMetric);
onINP(reportMetric);
onCLS(reportMetric);
These callbacks can be connected to a monitoring backend.
Why Real-User Monitoring Matters
A laboratory test provides useful controlled measurements.
But actual visitors use different devices, browsers, network connections, and interaction patterns.
A page that performs well on a fast desktop computer may behave differently on an older mobile phone.
Use both laboratory diagnostics and real-user measurements when possible.
Official documentation:
16. Create a Website Performance Budget
A performance budget defines measurable limits for important aspects of a website.
For example:
| Category | Example budget |
|---|---|
| JavaScript transferred | Under 200 KB |
| CSS transferred | Under 100 KB |
| Largest hero image | Under 250 KB |
| LCP | 2.5 seconds or less |
| INP | 200 ms or less |
| CLS | 0.1 or less |
| Unexpected console errors | Zero |
The resource-size values are illustrative starting points, not universal standards. Appropriate budgets depend on the application and its users.
Why Budgets Help
Without a budget, each new feature may add a small amount of overhead.
Over time, those additions accumulate.
A performance budget creates an explicit standard that developers can test during development.
Practical Exercise
Choose one webpage.
Record its current resource sizes and performance metrics.
Set a realistic improvement target.
Then compare results after each optimization.
17. Use AI to Investigate Website Performance
AI tools can assist developers with debugging and performance analysis.
They are particularly useful for explaining unfamiliar browser diagnostics, reviewing code, and suggesting experiments.
However, AI should not replace actual measurements.
Prompt 1: Performance Investigation
Act as a senior web performance engineer.
Analyze the following website performance
measurements and identify likely bottlenecks.
WEBSITE:
[URL or description]
METRICS:
[Paste measurements]
NETWORK OBSERVATIONS:
[Paste relevant findings]
JAVASCRIPT:
[Paste relevant code]
Provide:
1. Observed problems
2. Evidence supporting each problem
3. Likely causes
4. Additional measurements needed
5. Recommended fixes
6. Expected tradeoffs
7. A testing plan
Separate confirmed findings from hypotheses.
Do not invent measurements.
Prompt 2: JavaScript Performance Reviewer
Review this JavaScript code for performance
problems.
CODE:
[Paste code]
Identify:
- Repeated DOM operations
- Unnecessary calculations
- Long synchronous tasks
- Inefficient event handlers
- Memory retention risks
- Avoidable network requests
Provide an improved implementation.
Explain each change.
Preserve existing functionality.
Include a way to measure whether the
change actually improves performance.
Prompt 3: Core Web Vitals Improvement Plan
Act as a Core Web Vitals specialist.
My current metrics are:
LCP: [value]
INP: [value]
CLS: [value]
Page description:
[Details]
Create a prioritized improvement plan.
For each recommendation provide:
- Metric affected
- Likely root cause
- Specific implementation change
- How to test it
- Risks or tradeoffs
- Expected confidence level
Do not guarantee a specific score improvement.
Prompt 4: Technical SEO Audit
Act as a technical SEO specialist.
Review the following HTML and website structure.
[Paste relevant HTML and metadata]
Evaluate:
- Title and meta description
- Canonical URL
- Heading structure
- Internal linking
- Crawlability
- Mobile usability
- Structured data opportunities
- Page performance
Explain each issue and provide corrected code.
Distinguish technical issues from content
and search-ranking considerations.
Prompt 5: Accessibility Reviewer
Act as an accessibility specialist.
Review the following HTML, CSS, and JavaScript.
[Paste code]
Identify accessibility concerns related to:
- Semantic HTML
- Keyboard navigation
- Focus management
- Forms and labels
- Images
- Color contrast
- Dynamic content
- Responsive behavior
Provide corrected code and manual testing steps.
Do not claim complete WCAG compliance
from source review alone.
Prompt 6: Performance Experiment Designer
Help me design a controlled experiment
to improve website performance.
CURRENT PROBLEM:
[Describe issue]
BASELINE METRICS:
[Measurements]
PROPOSED CHANGE:
[Change]
Create:
1. Hypothesis
2. Measurement method
3. Test environment
4. Variables to control
5. Success criteria
6. Regression checks
7. Results recording template
8. Decision rule
Focus on measurable evidence rather
than assumptions.
These prompts help transform AI into a diagnostic learning partner.
18. Ten Practical Web Diagnostics Projects
Develop your skills by building real diagnostic tools.
Beginner
1. Website Metadata Checker
Inspect page titles, descriptions, headings, and canonical URLs.
2. Image Optimization Inspector
Identify missing dimensions and potentially oversized images.
3. JavaScript Error Monitor
Capture runtime errors and display them in a dashboard.
4. Resource Loading Explorer
Analyze resource timing entries and transfer sizes.
Intermediate
5. Performance Budget Monitor
Compare measured values against configurable limits.
6. Website Accessibility Checklist
Combine automated checks with guided manual testing.
7. Core Web Vitals Dashboard
Collect and visualize LCP, INP, and CLS measurements.
8. Network Request Analyzer
Track API response times, failures, and repeated requests.
Advanced
9. Automated Website Diagnostics Platform
Combine browser automation, performance reports, accessibility checks, and technical SEO analysis.
10. AI-Powered Website Performance Advisor
Use collected diagnostic evidence to generate prioritized improvement recommendations, with explicit uncertainty and verification steps.
Each project introduces useful software engineering and diagnostic skills.
19. A 14-Day Website Performance Challenge
Use this challenge to develop practical skills through consistent experimentation.
| Day | Topic | Challenge |
|---|---|---|
| 1 | Browser DevTools | Explore the Network and Console panels |
| 2 | Performance API | Measure navigation timing |
| 3 | Core Web Vitals | Record LCP, INP, and CLS |
| 4 | Images | Optimize a large image |
| 5 | JavaScript | Investigate a slow function |
| 6 | DOM | Improve repeated DOM updates |
| 7 | CSS | Diagnose rendering and layout problems |
| 8 | Network | Investigate slow requests |
| 9 | Caching | Compare first and repeat visits |
| 10 | Accessibility | Perform keyboard and label checks |
| 11 | Technical SEO | Review metadata and internal links |
| 12 | Performance budgets | Define measurable targets |
| 13 | AI-assisted debugging | Investigate a real performance issue |
| 14 | Final project | Build and explain a diagnostics dashboard |
Recommended Learning Process
For every challenge:
- Record the initial behavior.
- Predict the likely cause.
- Collect measurements.
- Make one targeted change.
- Measure again.
- Record the result.
- Explain what you learned.
This is more effective than making several unrelated changes and hoping performance improves.
20. Ten Common Website Performance Mistakes
1. Optimizing Without Measuring
Start with evidence rather than assumptions.
2. Treating Lighthouse Scores as the Entire User Experience
Use field data and manual testing as well.
3. Loading Oversized Images
Deliver appropriately sized, compressed assets.
4. Blocking the Main Thread
Investigate long-running JavaScript operations.
5. Ignoring Layout Stability
Reserve space for images and dynamic content.
6. Loading Too Much JavaScript
Remove unnecessary code and defer noncritical work.
7. Misconfiguring Caching
Use appropriate cache policies and asset versioning.
8. Ignoring Mobile Devices
Test under realistic device and network conditions.
9. Treating Accessibility as Separate from Quality
Accessible interfaces improve usability for a wider audience.
10. Making Changes Without Regression Testing
Verify that performance improvements do not break existing functionality.
21. Vibe Learning: Turn Website Problems into Learning Opportunities
Web diagnostics is an ideal subject for discovery-based learning.
Every performance problem begins with a question.
Why is this page slow?
Why does the layout shift?
Why does this button respond slowly?
Why is a particular resource taking so long to download?
Rather than immediately searching for a solution, learners can investigate the behavior.
This aligns with Vibe Learning, an approach centered on active exploration, experimentation, reflection, and practical understanding.
The Web Diagnostics Discovery Cycle
Explore: Observe how a webpage behaves.
Predict: Form a hypothesis about the problem.
Measure: Collect browser performance evidence.
Investigate: Identify the likely root cause.
Experiment: Make a targeted change.
Evaluate: Compare before-and-after results.
Understand: Explain why the change helped or failed.
Improve: Refine the implementation and repeat.
Example Learning Activity
Start with a webpage containing an oversized image.
Ask learners:
“What do you think will happen if we reduce the image size by 70%?”
Have them record the current loading measurements.
Then optimize the image and repeat the test.
Compare the results.
Did the transferred bytes decrease?
Did LCP improve?
Did the image still look acceptable?
Did another resource become the bottleneck?
This activity teaches more than an optimization technique.
It teaches how to investigate a real engineering problem.
Vibe Teaching Opportunities
Educators can create challenges in which learners:
- Identify a hidden performance bottleneck.
- Repair a slow JavaScript function.
- Investigate a layout shift.
- Compare caching strategies.
- Optimize a responsive image.
- Diagnose a failed API request.
- Improve an inaccessible form.
- Evaluate AI-generated optimization advice.
The goal is to develop confident developers who understand how websites behave.
22. Explore the Web Diagnostics & Performance Academy
Understanding website performance is a valuable skill for every modern developer.
Whether you’re building a personal website, an educational platform, a JavaScript application, an online store, or an AI-powered tool, the same principles apply.
Measure behavior.
Investigate problems.
Identify causes.
Make targeted improvements.
Test the results.
The Web Diagnostics & Performance Academy provides a starting point for developing these skills through practical exploration.
Explore the FREE Web Diagnostics & Performance Academy
Continue Learning
JavaScript Discovery Academy
HTML & CSS Discovery Academy
TypeScript Discovery Academy
AI Application Engineering Studio
More DiscoveryVIP Guides
Vibe Learning Tools
Official Learning Resources
web.dev Performance
Core Web Vitals
Chrome DevTools
MDN Performance API
Google PageSpeed Insights
WebPageTest
W3C Web Accessibility Initiative
Google Search Central
Final Thoughts: Better Websites Begin with Better Questions
Website performance isn’t just about making pages load faster.
It’s about creating better experiences for real people.
A fast-loading website helps visitors access information sooner.
A responsive interface makes applications easier to use.
An accessible design allows more people to interact with your content.
A technically sound website is easier to maintain, troubleshoot, and improve.
But none of these improvements happen consistently through guesswork.
They require observation, measurement, investigation, and experimentation.
That’s what makes web diagnostics such a valuable development skill.
You learn to look beyond what appears on the screen and understand how the browser, network, JavaScript, CSS, and server work together.
Start with one page.
Identify one problem.
Measure it.
Make one improvement.
Then measure again.
Don’t just build websites that work. Build websites that perform, respond, and deliver better experiences.
About the Author
Laurence Svekis is a Google Developer Expert (Google Workspace), Google Champion, author, software developer, and AI educator who has taught 3 million+ students worldwide.
He is the creator of Vibe Learning and Vibe Teaching, approaches focused on experiential learning, AI-assisted education, interactive experimentation, critical thinking, and practical skill development.
Through DiscoveryVIP.com and VibeLearning.ca, Laurence creates free interactive learning tools, programming challenges, educational guides, and hands-on resources covering JavaScript, HTML, CSS, TypeScript, artificial intelligence, Google Apps Script, automation, web development, and software engineering.