You can simply iterate over all the elements on the page and check if this image has or has some background image. The biggest problem with this solution is that it is very slow (however, its performance can be improved in several ways). Here is the code:
$('*').each(function(){ var backImg; if ($(this).is('img')) { console.log($(this).attr('src')); } else { backImg = $(this).css('background-image'); if (backImg != 'none') console.log(backImg.substring(4, backImg.length-1)); } });
source share