-1

I'm needing open a window behind parent window, and I'm not finding anything to do that. Could someone help me with this code or tips?

Parent.php

<script type="text/javascript">

$(document).ready(function () {
    window.name = "parent";
    $('#link').click(function (event){ 
        event.preventDefault();
        window.open('child.php', 'fullscreen=yes', 'scrollbars=auto');
    });
});
</script>



<body>
        <a id="link" href="/">Open Window </a>
</body>

child.php

<script type="text/javascript">//<![CDATA[
    $(document).ready(function () {

        $('#link').click(function(event){
            event.preventDefault();
            console.log(window.opener.location);
            var goBack = window.open('', 'parent');
            goBack.focus();

    });
    });//]]> 

    </script>


    <body>

        <a id="link" href="#">Return to Parent </a>

    </body>

LINK CODE: http://pontodosjogos.com/testegrana.php

Murilo
  • 49
  • 9
  • Did you google it? Try this problem: http://stackoverflow.com/questions/11407153/open-a-window-behind-the-current-window-using-javascript-jquery – Kashif Ullah Dec 30 '15 at 05:56
  • I tried using the link code that you sent me, does not it works. @KashifUllah – Murilo Dec 30 '15 at 06:07
  • I got this code, except that it only works if you place a return link and put the function to identify the click on the link. I want her to come back automatically, without having to click anything. @KashifUllah – Murilo Dec 30 '15 at 06:14
  • Could you please post your code, so that I can see the problem. – Kashif Ullah Dec 30 '15 at 17:31
  • I edited the question and put the code. @KashifUllah – Murilo Dec 30 '15 at 17:39

1 Answers1

1

You can use this code to display a pop-under window:

<script>

//specify page to pop-under
var popunder="http://yahoo.com";

//specify popunder window features
//set 1 to enable a particular feature, 0 to disable
var winfeatures="width=800,height=510,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0";

function loadpopunder()
{
 win2=window.open(popunder,"",winfeatures);
 win2.blur();
 window.focus();
}    

loadpopunder();


</script>

Source: http://www.javascriptkit.com/script/script2/popunder.shtml

Keep in mind that browsers will likely block the pop-under window and it is generally annoying seeing those from a user's perspective so try to not overdo those.

NovaLogic
  • 658
  • 13
  • 21