I have a web application that works in Chrome with the same origin policy, disabled (i.e. --disable-web-security). I use window.open()to create a new window that loads a URI, which sometimes redirects. If the redirection does not occur, I can read the contents of the document placed inside the window using the property documentwhen the event fires onload. Unfortunately, in cases where redirection occurs, it seems that it onloadnever works, and the window object returned from window.open()is no longer useful.
Here is the code to give you an idea of what is going on:
var win = window.open('http://somewhere');
win.onload = function() {
doStuffWith(win.document.body);
win.close();
};
Is there a way I can hold a valid descriptor windoweven if the redirection happens immediately after opening a new window?
In the @CBroe sentence, I expanded my code to find out if I can get the contents of the window if I wait a bit. After the above code, I added:
setTimeout(function() {
console.log(win.location);
doStuffWith(win.document.body);
}, 5000);
locationreported as swappedout://(huh !?) and the document body is empty.
source
share