Get data from the iFrame URL on each page of the iframe



I'm using same URL for iFrame source and Website.

The main URL is:

In iFrame it is : < iframe src="[email protected]&">< /iframe>

Iframe is for our partners who want to offer our service on there own website, in this case Main URL is for our own User to browse through the platform.

So the code as in front-end and backend is same for both, in iFrame we just changes the logo, name, background colour, etc , which our partner has provided.


Problem is that first time when the iFrame loads I'm able to get the below from the URL using $_REQUEST or $_GET. But when user go into other pages within iFrame than $_GET['key'] returns blank, hence it's not able to fetch the data from URL.

[email protected]

Is it possible to Get the data on every page from the iFrame src as we're getting first time. The iFrame source remains always the same but when it comes to get the Data from iFrame source, it return blank.

I'll really appreciate your your guidance in this.

Regarding my comment, have a look at this function

function hyperlink($url, Array $persist, Array $source) {
    $variables = array();

    foreach ($persist as $key)
        if (isset($source[$key]))
            $variables[$key] = $source[$key];


    return $url.'?'.http_build_query($variables);

On your templates, everytime you want to output an URL you must do it like

<?php echo hyperlink('', $iframe_vars, $_GET); ?>

Where $iframe_vars must be an array with the name of the variables you use with iframes and must be persisted across requests

$iframe_vars = array('key','an','uname','web');