Javascript: persistence of window refrence object?

My javascript code opens several windows:

var win = window.open();

I store the win link in an array with all windows open.
Everything works fine until the knife is updated.

So, I would like to get all the links to open windows when the "master" window loads.

To understand this, I need to:
1. keep all download links 2. return download links 3. update the links using a new opener

Is it possible? if so, how?

+3
source share
3 answers

How I solved the problem.

"openener" WINDOW, , , , , openener . , null, - *

unload javaScript , -. -, , - .

, !;)

, , , , , , www.google.com .

Firefox, IE Chrome.

* Chrome, , , .

+3

(: ).

, , , HTTP.

- , . , . .... "".... , ... , . , , , , , - , .


chrome/FireFox, IE.

- , , /, . script/ .   , .

:

  • Child
  • ** → .
  • ** → .
  • ** , null

HTMLPage.htm:

<input type="button" onclick="openChild();" value="Open Child" />
<input type="button" onclick="refreshParent();" value="Refresh Parent" />
<input type="button" onclick="linkParent();" value="Link Parent" />
<input type="button" onclick="checkRelationship();" value="Check Relationship" />
<input type="button" onclick="refreshChild();" value="Refresh Child" />


<script type="text/javascript" language="javascript">

    var child;    
    function openChild() {
        child = window.open("HTMLPage.htm");
    }

    function refreshParent() {
        alert("refreshing parent");
        window.opener.location.href = window.opener.location.href;
    }

    function linkParent() {
        window.opener.child = window;
        checkRelationship();
    }

    function checkRelationship() {
        alert("Parent: " + window.opener + ".   Children:" + child);
    }

    function refreshChild() {
        child.location.href = child.location.href;
    }


</script>

, :

? / , , ?

? iframe ( IE .., ).

- , IFrames : http://developer.apple.com/internet/webcontent/iframe.html

, .

+4

( AJAX iframes), " " , " " -

0

Source: https://habr.com/ru/post/1766430/


All Articles