Add iframe params to parent: remote domain

This demo works for HTTP and HTTPS. You are on HTTP right now Please click here to get to the HTTPS version.

< back to the overview of "Add iframe url to parent"

Example 60: Add iframe params to parent: Remote domain

This example shows how the current iframe parameters are added to the parent url as parameter if the iframe is on a remote domain. This features is only available in the pro version of the advanced iframe.

To make it easier to copy/paste the examples most examples are fully configured in the shortcode directly. I use use_shortcode_attributes_only="true" that none of the settings from the administration are used.

This solution this is another version of the "Add iframe url to parent". The difference to the existing solutions is that only the parameters are added to the parent url. To make it work, you also have to use placeholders in the url or the "Forward params to iframe" feature. The advantage of this solution is that the parent url and the iframe url look quite the same. In the other solutions you either have the full iframe url + params, a short iframe url + params, a hash or a url rewrite with the hash.

So if your iframe url ist e.g. then your parent url will look like

You can enable this for the remote domain by adding
add_iframe_url_as_param="remote" add_iframe_url_as_param_direct="true"
You need to be able to use the external workaround because the parameters need to be transferred from the remote domain to the parent.

If someone would now refresh the parent the parent has the parameters needed. To forward them now to the iframe you have 2 options:

  • Forward params to iframe: You have to add url_forward_parameter to your shortcode with url_forward_parameter="ALL" or if you like to be more restrictive: url_forward_parameter="mypage,mylevel" - this way is shown in example 59 -> Add iframe params to parent: same domain
  • Use placeholders the the iframe url: src="{query-mypage}&mylevel={query-mylevel}" - This way is shown on this page.

Please check that your parameters are not used by WordPress itself. See here.

Click on the different links in the iframe and check the url in the address bar. Also reload the page when you are on a different page. The demo page prints the url of the iframe so you can easier see what is going on. The 3 links have all different parameters.

Important: The feature only works if you don't have any other query parameters as they are all replaced! If you need other parameters as well please pick one of the other solutions. Also it does not work in the preview of WordPress as there the page_id and the preview parameter is used. Publish the page and test it there.

This is the shortcode for this:
[advanced_iframe securitykey="your key" src="//{query-mypage}&mylevel={query-mylevel}" use_shortcode_attributes_only="true" id="example60" height="170" width="100%"  add_iframe_url_as_param="remote" add_iframe_url_as_param_direct="true"]

On the remote page you have to add
var updateIframeHeight = "true";
var iframe_id = "example60"; // needs to match to find the iframe on the parent
var add_iframe_url_as_param="remote";
<script src="//"></script>