-4

Say I have a website with the following pages:

page1.html, page2.html, page3.html

for each one of these pages, load the page, and get the console logs.

MackProgramsAlot
  • 570
  • 1
  • 3
  • 16

1 Answers1

2

Use iframe and load your next html files changing .src with onload event. The console.logs from each html file will be shown in your console.

var iframe = document.getElementById('iframe');
var iter = 0;
var myLinks = ['page1.html','page2.html','page3.html']; //replace with your correct existing urls
iframe.src = myLinks[0];

iframe.onload = function(){
 iter++;
 if(iter===myLinks.length) return;
 iframe.src = myLinks[iter];
};
<iframe id="iframe" src=""></iframe>
Paweł
  • 3,261
  • 2
  • 14
  • 31