Skip to content

Instantly share code, notes, and snippets.

@jonathands
Created September 1, 2019 18:23
Show Gist options
  • Select an option

  • Save jonathands/7f7cd4da48ac8b6bd822878d69a4c184 to your computer and use it in GitHub Desktop.

Select an option

Save jonathands/7f7cd4da48ac8b6bd822878d69a4c184 to your computer and use it in GitHub Desktop.
Concatenating several Links for printing
let tipUrlList = Array();
let index = 0;
let htmlContent;
document.querySelectorAll("pre a").forEach(function(e){
tipUrlList.push(e.href);
});
function loadPage(){
let xhr = new XMLHttpRequest();
xhr.onload = function(data){
console.log('d:on'+index)
htmlContent += (this.responseText);
if(index==tipUrlList.length)
{
console.log('d:c')
document.body.innerhtml = htmlContent;
}else{
console.log('d:l')
loadPage(index++)
}
}
xhr.open('get',tipUrlList[index]);
xhr.send()
}
loadPage()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment