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

174
Visualizações
Get Request in iframe URL

Currently a 3rd party is serving up my URL in their iframe. All they have is an iframe for me and are not very flexible. They hard code whatever URL I have previously provided.

<iframe url="https://firstURL.com"></iframe>

I now want to differentiate a person between 2 groups. So, if they are in group 1, they go to the current flow url. If they're in group 2, I'd like the iframe to serve up a different url. I have a api that would receive that person's information, determine what group they are a part of, and then return the correct URL that pertains to their group.

app.get("/PersonCheck", function ( req, res ) {
    var personInfo = req.query.personInfo || 100;
    var tf = callGroupManagement( personInfo ); //returns true or false
    console.log("tf is ", tf);
    if( !tf ){
        res.send('https://firstURL.com');
    } 
    else {
        res.send('https://secondURL.com');
    }
}

So, since I have little flexibility I'd like to do something like this:

<iframe url="http://myApi.com/PersonCheck"></iframe>

However as you probably can guess that method returns https://firstURL.com and https://secondURL.com as strings and just shows them as strings in the iframe.

QUESTION: Is there a way render a returned url in the iframe url call? If not what would be a better strategy to achieve this.

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

0

The answer isn't on the iframe side. In the server side code I change:

res.send(<whateverURL>);

to the following:

res.redirect(<whateverURL>);

This "changes" the URL of the iframe 1) it's an iframe and 2) in my case that doesn't matter.

More notes can be found in the express docs

about 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