I have the following code that opens a popup window where I get some data from the database:
<script>
$("button").click(function(){
window.open("janela.php", "_blank", "width=400, height=500");
});
</script>
In the popup window open, there is a button where the user clicks to send data to the main window ( janela.php
), which opened the popup : p>
<script>
$(".botao").click(function(){
// outros códigos aqui que não vem ao caso
$(window.opener.document).find("#status").text("Salvo!");
});
</script>
Everything works perfectly.
Doubt: How to do this so that when you click the opener
button on the .botao
, the focus pass from the popup to the main window (% with%)? That is, by clicking the popup switch to the background and the popup
window is in the foreground on the screen.
Need something crossbrowser , which works in browsers Chrome, Firefox, Safari, Opera, IE (at least 11) and Edge.