Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!