I have this code that it does almost that. The only problem is that I need the user to click on a link so that the main window is in front. I want to open the window automatically after the main window.
This is the code that opens the Window.
<script type="text/javascript">
$(document).ready(function () {
window.name = "parent";
$('#link').click(function (event){
event.preventDefault();
window.open('filho.php', 'fullscreen=yes', 'scrollbars=auto');
});
});
</script>
<body>
<a id="link" href="/">Open Window </a>
</body>
This is the code that goes back to the page by clicking on the link.
<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>
CODE LINK RUNNING: link