jquery - How to get a different window's html with javascript -
i open new window using url, grab html string , display in console of original window.
from how element , html window.open js function jquery , 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 created, don't see popup's html in original window's console.
what doing wrong?
if it's not on same domain, i'm pretty sure isn't possible it's not possible iframe: get html inside iframe using jquery.
however, if own both pages, should able use described in first answer question linked (how element , html window.open js function jquery)
note: if control both parent , child source, have child invoke method on parent passes in it's html:
child window
// call when body loaded function sendhtmltoparent() { window.opener.htmlreceiver(document.outerhtml); }
parent
function htmlreceiver(html) { console.log(html); }
Comments
Post a Comment