Is it possible to identify if the page was opened in a pop-up?
I want to do this with javascript or jquery.
I have the test.html page, and if it is opened in a precise pop-up it will appear a link to closing 'close'
Can you do this?
Is it possible to identify if the page was opened in a pop-up?
I want to do this with javascript or jquery.
I have the test.html page, and if it is opened in a precise pop-up it will appear a link to closing 'close'
Can you do this?
WINDOW.OPENER
When you open a page using techniques such as window.open
, the Window.opener
variable is fed with the page information that generated the request. If the page has not been opened this way, it returns NULL
:
if (window.opener) { // Window.opener recebe os dados da página que gerou a atual
document.getElementById("fechar").style.display = "block";
}
#fechar {
display: none;
}
<a id="fechar">FECHAR</a>
<p>Essa é sua Página.</p>