URL features

This page shows the different ways to pass parameters from the parent page to the iframe and also how to add WordPress data like the current user.

Please note that I only show many different settings here with no real iframe.  It is easier to see if I  directly show the output of the src element in the iframe.

Example 47: URL forward parameters (free + pro)

The setting url_forward_parameter does forward parameters from the url of the parent page to the url of the iframe.

Setting Parent url iframe url Description
 ALL ?param1=foo&param2=foo2 ?param1=foo&param2=foo2 This does forward all parameters of the parent to the iframe.
 param ?param=foo&param2=foo2 ?param=foo This does only forward the parameter param to the iframe
 param,param2 ?param=foo&param2=foo2 ?param=foo&param2=foo2 This does forward the parameter param and param2 to the iframe
ainame|name ?ainame=foo ?name=foo Pro users can also map incoming parameters to a different parameter. WordPress has a couple of reserved words which can't be used in urls. So if you want to pass the parameter "name" (reserved word) to your iframe you can do a mapping with "ainame|name". Than the parameter "ainame=hallo" will be passed as "name=hallo" to the iframe. This can also be used if the parameters of the 2 pages do not match.
param ?param=foo{{foo2 }} ?param=foo[foo2] If your parameters contain [] you can use {{ }} which will internally replaced.
param ?param=foo ?iframeparam=fooiframe&param=foo  If the iframe does already has a parameter the parameter of the parent is added after the one from the iframe.
param ?param=http://www.föö.com ?param=http://www.föö.com If all characters are in the white list @a-zA-Z0-9À-ÖØ-öø-ÿ/:-|)( the value is not encoded.
param ?param="<script>alert(42)</script> ?param=%22%3Cscript%3E
alert%2842%29%3C
%2Fscript%3E
If one character is not in the white list @a-zA-Z0-9À-ÖØ-öø-ÿ/:-|)(  the value is encoded.

 

Example 48: Map parameter to url (pro)

The examples can be found at "Map parameter to url" on the "Advanced settings" tab in the  "Url parameter handling" section. If this is unclear please contact me and I add some more examples here.

Example 49: Using placeholders in the src parameter (pro)

The src parameter can do much more then you simply add an url there! There are many placeholders available and also shortcodes are supported. Even support for a pdf does work. Placeholders that cannot be resolved are removed since version 7.3. Many of the settings are hopefully clear. Therefore I only make examples for the more complicated ones!

Setting
Parent url iframe url Description
//www.test.com/{userid,none} n.a. //www.test.com/1 Adds the id when the user is logged in
//www.test.com/{userid,anonymous} n.a. //www.test.com/anonymous Adds the default when the user is not logged in
//www.test.com/val={urlpath2} //www.parent.com/path1/path2/path3 //www.test.com/val=path2 Extract the 2nd element of the path and adds it to the url
//www.test.com/{urlpath-1} //www.parent.com/path1/path2/path3 //www.test.com/path3 Extracts the last element and adds it to the url
//www.test.com/val={query-test} //www.parent.com/path1/?test=123 //www.test.com/val=123 Extracts the test parameter and adds it to the url
//www.test.com/val={query-test,notfound} //www.parent.com/path1/?var=123 //www.test.com/val=notfound The test parameter was not found. Therefore the default is used and added to the url
//www.test.com/val={query-test} //www.parent.com/path1/?var=123 //www.parent.com/path1/?var= the parameter test was not found and no default is given. Therefore the placeholder is removed
//demo.{{url domain='home'}}/url n.a. //demo.domin.de/url SHORTCODE: You have to replace the bracket [ with {{ and ] with }}. So if the shortcode is [link] you have to use {{link}} because shortcode attributes which include shortcodes are not supported directly by WordPress. Also be aware of single and double quotations: src="http://demo.{{url domain='home'}}/url". So only use ' for attributes of the nested shortcode.

Have fun using Advanced iFrame Pro,

Michael