Skip to content
jshacks.dev
Security

Find what a page loads from third parties in DevTools

List every third-party domain a page loads from by running a snippet over the performance entries in DevTools, so you know who can run code on it.

1 min read
Summarize in AI

Every script, font and image host is someone you trust, and a script host can read the page. A few lines in the DevTools console list them.

consoleJavaScript
const here = location.hostname;
const hosts = new Map();

for (const entry of performance.getEntriesByType('resource')) {
  const host = new URL(entry.name).hostname;
  if (host !== here) hosts.set(host, (hosts.get(host) ?? 0) + 1);
}

console.table([...hosts].map(([host, requests]) => ({ host, requests })));
Text
┌─────────┬──────────────────────────┬──────────┐
│ (index) │ host                     │ requests │
├─────────┼──────────────────────────┼──────────┤
│ 0       │ 'www.googletagmanager.com' │ 2      │
│ 1       │ 'fonts.gstatic.com'      │ 3        │
└─────────┴──────────────────────────┴──────────┘

performance.getEntriesByType('resource') returns one entry per request the page made, and the name is the full URL. Run it after the page has settled and scroll once so lazy resources load. The table shows an example; yours will list your own hosts. See PerformanceResourceTiming on MDN.

Requests made by scripts after the snippet runs, and by other frames, are missed. For a full list use the Network panel, filtered with -domain:yoursite.com.

Also inDebugging
Share

More snippets

Debugging

Group related logs with console.group

Indent related console output under a label with console.group and console.groupEnd, so interleaved logs from one request stay readable in Node.js 24.

1 min read

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.