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

275
Visualizações
Get site-URL-parameter from iframe (same domain)

I've got two html pages (site, sub). sub.html is embeded in the site page as an iframe. On the sub page I am running the following js:

    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    const param1 = urlParams.get('param1')
    const param2 = urlParams.get('param2')
    alert (param1 + param2)

It works fine. When I open .../sub.html?param1=hello&param2=world, I end up with "Hello World". But the URL-parameters are on "site.html" not on sub.html. So I open site.html?param1=hello&param2=world how do I get those URL parameters? I read that that is not possible if both sites are not on the same domain. In my case - they are on the same domain, so that should not a problem. At the time I am just testing it locally.

about 4 years ago · Juan Pablo Isaza
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