Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a new window object without iframes?

Tags:

javascript

How can I make a new Window object, myWindow, that is independent to window (so modifying e.g. myWindow.Array.prototype does not effect window.Array.prototype), without creating an <iframe>?

At the moment I'm doing it as follows

function newWindow(){
    var myFrame = document.createElement('iframe'), myWindow = undefined;
    myFrame.style.display = 'none';
    myFrame.src = 'javascript:undefined;';
    document.body.appendChild(myFrame);
    myWindow = myFrame.contentWindow;
    document.body.removeChild(myFrame);
    return myWindow;
}

Ultimately, I'd like to make my own copies of core object types and prototype them.

like image 299
Paul S. Avatar asked Sep 14 '12 00:09

Paul S.


1 Answers

Emm... you can't do that. Well... you may call window.open, but it will open a new window. And... why do you need that at all? It looks like you are on wrong way.

like image 131
Viktor S. Avatar answered Sep 22 '22 17:09

Viktor S.