I would like to open a new window using a url, grab its html as a string and display it in the console of the original window.
From How to get element and html from window.open js function with jquery , I tried:
console.log('response', url)
var popup = window.open(url, '_blank', 'width=500,height=500');
popup.onload = function() {
setTimeout(function(){ console.log( 'hi',popup.document.documentElement.outerHTML) }, 2000);
}
The popup window is created, but I don't see the popup's html in the original window's console.
What am I doing wrong?