Refresh a window when closing another [closed]

-1

I have a page with a listing of photos. The user clicking on "add photos" opens another tab where the user can add photos. But at the end of inserting them, this flap is closed. What I wanted, was that when I close the window, where I add the photos to the list window Refresh the listing of photos automatically. Is it possible?

    
asked by anonymous 17.02.2014 / 20:55

2 answers

1

Your question is missing much detail. I'll respond in a relaxed way hoping to help you.

My suggestion:

HTML

<div id="conteudoJanela">
    <div>Adicione um url aqui:
        <input id="urlImagem" type="text" />
        <br />Exemplo: http://goo.gl/6I4zTg</div>
    <hr />
    <button type="button">Enviar</button>
</div>
<button type="button" id="abrir">Abrir nova janela</button>
<hr/>Lista de URL's
<div id="listaURL"></div>

javascript / jQuery

var conteudo = $('#conteudoJanela').html();

$('#abrir').on('click', function () {
    var win = window.open("", "", "width=400, height=200");
    $novaJanela = $(win.document.body);
    $novaJanela.html(conteudo);
    $novaJanela.find('#enviar').on('click', function () {
        var url = $novaJanela.find('#urlImagem').val();
        $('#listaURL').append(url + '<br />');
        win.close();
    });
});

CSS

#conteudoJanela {
    display: none;
}

Example

    
17.02.2014 / 21:39
0

Test using this method

function closeCallback() {
    //your code here
}

var openTab = function(uri, name, options, closeCallback) {
    var win = window.open(uri, name, options);
    var interval = window.setInterval(function() {
        try {
            if (win == null || win.closed) {
                window.clearInterval(interval);
                closeCallback(win);
            }
        }
        catch (e) {
        }
    }, 1000);
    return win;
};
    
17.02.2014 / 20:56