This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2017.
Note: This feature is available in Web Workers.
The initiatorType read-only property is a string representing web platform feature that initiated the resource load.
Note: This property does not represent the type of content fetched. A .css file can be fetched using a <link> element leading to an initiatorType of link. When loading images using background: url() in a CSS file, the initiatorType will be css and not img.
The initiatorType property can have the following values, or other if none of the conditions match.
audioIf the request was initiated by an <audio> element's src attribute.
beaconIf the request was initiated by a navigator.sendBeacon() method.
bodyIf the request was initiated by a <body> element's background attribute.
cssIf the request was initiated by a CSS url() function.
early-hintIf the request was initiated by an 103 Early Hint response.
embedIf the request was initiated by an <embed> element's src attribute.
fetchIf the request was initiated by a fetch() method.
frameIf the request was initiated by loading a <frame> element.
iframeIf the request was initiated by an <iframe> element's src attribute.
icon Non-standard If the request was initiated by a favicon. Non-standard and only reported by Safari.
imageIf the request was initiated by an <image> element.
imgIf the request was initiated by an <img> element's src or srcset attribute.
inputIf the request was initiated by an <input> element of type image.
linkIf the request was initiated by a <link> element.
If the request was initiated by a navigation request.
objectIf the request was initiated by an <object> element.
pingIf the request was initiated by an <a> element's ping.
scriptIf the request was initiated by a <script> element.
trackIf the request was initiated by a <track> element's src.
videoIf the request was initiated by a <video> element's poster or src.
xmlhttprequestIf the request was initiated by an XMLHttpRequest.
The initiatorType property can be used to get specific resource timing entries only. For example, only those that were initiated by <script> elements.
Example using a PerformanceObserver, which notifies of new resource performance entries as they are recorded in the browser's performance timeline. Use the buffered option to access entries from before the observer creation.
const observer = new PerformanceObserver((list) => {
const scripts = list
.getEntries()
.filter((entry) => entry.initiatorType === "script");
console.log(scripts);
});
observer.observe({ type: "resource", buffered: true });
Example using Performance.getEntriesByType(), which only shows resource performance entries present in the browser's performance timeline at the time you call this method:
const scripts = performance
.getEntriesByType("resource")
.filter((entry) => entry.initiatorType === "script");
console.log(scripts);
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
initiatorType |
43 | 12 | 35 | 30 | 11 | 43 | 35 | 30 | 11 | 4.0 | 43 | 11 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming/initiatorType