GetComputedStyle () and properties that may have an associated URL

I am trying to make a javascript fragment that can get a list of all the images (or other resources) that are used on a web page because they are specified in css. These are usually background images, because somewhere in css there is something like this:

.something {
  background: transparent url(images/somethingbg.png) no-repeat top left;
  }

It seems I can get it all into an array (with a full path) with the following snippet:

var outputArray = [];
var string = "";
var elems = document.getElementsByTagName('*');
for (var i = 0; i<elems.length; i++) {
 var elem = elems[i];
 var style = window.getComputedStyle(elem, null);
 var value = style.getPropertyValue("background-image");
 if (value && value != "" && value != "none")
  outputArray.push(value);
 }

However, I want this to work on any file (works like a bookmarklet), and I know that url () can be applied to things that are not background images, such as "list-style-image". Is there any more? Is there a list somewhere?

+3
source share
1 answer

AFAIK here is a pretty comprehensive (?) List:

  • ( ) url("") CSS3
  • list-style-image ( -)
  • (-ms-behavior), (-ms-filter), filter -moz-binding
  • URI : href, cite, xmlns, src, data- *, data, codebase, classid, archive, longdesc, profile...
  • @import, @namespace @font-face
+2

All Articles