const observer = new PerformanceObserver((list) => {
const javascriptResources = list
.getEntries()
.filter((entry) => entry.contentType === "text/javascript");
console.log(javascriptResources);
});
observer.observe({ type: "resource", buffered: true });PerformanceResourceTiming: contentType property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const scripts = performance
.getEntriesByType("resource")
.filter((entry) => entry.contentType === "text/javascript");
console.log(scripts);