The Resource Timing API collects data on outbound requests, should leave capacity to collect images in both CSS and inline styles performantly.
Haven't tested this, but something akin to this should help you get started:
if ( !('performance' in window) ||
!('getEntriesByType' in window.performance) ||
!(window.performance.getEntriesByType('resource') instanceof Array)
) {
alert('unsupported');
} else {
window.addEventListener('load', function() {
var resources = window.performance.getEntriesByType('resource');
for(var index in resources) {
for(var properties in resources[index]) {
console.log(properties);
console.log(resources[index][properties]);
}
}
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…