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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -