Answers for "javascript get all script tags on page"

0

javascript get all script tags on page

var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
  if (scripts[i].src) {
  	console.log(i, scripts[i].src);
  } else { 
    console.log(i, scripts[i].innerHTML);
  }
}
Posted by: Guest on December-11-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language