Tuesday, 25 April 2017

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.



via discodane

No comments:

Post a Comment