Skip to content

Instantly share code, notes, and snippets.

@blech75
Created September 3, 2010 20:12
Show Gist options
  • Save blech75/564487 to your computer and use it in GitHub Desktop.
Save blech75/564487 to your computer and use it in GitHub Desktop.
a little Prototype.js magic for returning the domains of external JS files
$A(document.getElementsByTagName('SCRIPT')).reject(function(s){
return !s.getAttribute('src');
}).map(function(s){
return s.getAttribute('src');
}).reject(function(u){
return u.charAt(0) == "/";
}).map(function(u){
return /^https?:\/\/([^/]+)/i.exec(u)[1];
}).uniq();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment