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

150
Visualizações
Can I get a parameter from shortened URL through an Iframe?

I have shortened URL's scanned from QRCODES. The full URL has some parameters that I need.

I'm putting up an Iframe to load the shortened URL and was hoping to get the "full" url once it loaded.

But didn't get to work...

Is it possible?

Once the Iframe is loaded, I try access it using:

iframe.contentWindow.location.href

But always get an error

ERROR DOMException: Blocked a frame with origin "http://localhost:8100" from accessing a cross-origin frame.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are solutions to the communication between iframe and host if you control the content of both windows, but they often feel like hacks and can be limiting.

For a general solution, you could get the redirected URL before you even load the iframe.

The fetch api has a "redirect" option you can set to "manual" to get the URL it redirects to.

fetch(shorturl, {redirect: "manual"})
   .then(function(response) {
       var iframeurl;
       if (response.type==="opaqueredirect") {
           // set to redirected url
           iframeurl = response.url
       }
       else {
           // use original url.
           iframeurl = shorturl
       }
       iframe.contentWindow.location.href = iframeurl;
       handleQueryString(iframeurl)


   })

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