Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
window.open to read the url of popup
<!DOCTYPE html>
<html>
<body>

<h1>The Window Object</h1>
<h2>The open() and close() Methods</h2>

<button onclick="openWin()">Open "myWindow"</button>
<button onclick="closeWin()">Close "myWindow"</button>

<script>
let myWindow;

function openWin() {
  myWindow = window.open("https://google.com", "", "width=2600,height=500");
  gg = myWindow.location.origin
  alert(gg)
}

function closeWin() {
  myWindow.close();
}
</script>

</body>
</html>

im aware that because of security reasons browsers wont let you read other tabs

but there is something i wanna know if the parent can open the popup page and close the popup page that means the popup page is still can be accessed through parent page

but is there any slightest chance where the parent page can read url of the popup page

using javascript or any library ? if so how ? considering there is no content security headers present for that popup page

iframe is getting blocked because x-frame headers

all i wanted is to just grab the url

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You could access it with myWindow.location.href but only if both windows are on the same subdomain.

Otherwise it is impossible due to same origin policies. Your best option would be to store the url in a variable

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda