Quickstart guide, display options, vote for the plugin on codecanyon
Advanced iFrame Pro - Quickstart guide, widget, display options, vote for the plugin on codecanyon
Quick start guide
To include a web page to your page please check the following things first:
Most likely you have one of the following setups:
- iframe cannot be included: You cannot include the content because the owner does not allow this.
- iframe can be included and you are on a different domain: See the feature comparison chart. To resize the content to the height/width or modify css you need to modify the remote iframe page by adding one line of Javascript to enable the provided workaround.
- Iframe can be included and you are on the same domain: All features of the plugin can be used.
If you mix http and https read
this blog. Parent https and iframe http does not work on all browsers!
Advanced iFrame Pro Widget
The
pro version also does offer a widget where you can include the iframe.
The usage is really simple. Go to Appearance -> Widgets and insert
the shortcode you would normally put into a page into the text field of
the "Advanced iFrame Pro Widget" .
Vote for the plugin
Thank you for getting Advanced iFrame Pro at Codecanyon.
Please feel free to leave an item rating from your items download page if you haven't already done so.
Please
get in contact with me if you have problems because most of the issues
are easy to solve. But at least tell me what you did not like so I can
improve this. Also make sure that you took a look at the quick start
guide to make sure the feature you like can be used!
Display options
Default settings
Advanced iFrame Pro - Default settings
This plugin will include any content an advanced iframe. Please
enter the url and the size you want to include your page. You have a
couple of additional default options which help to integrate your site
better into your template. You can overwrite all of these settings by
specifying the parameter in the shortcode. Please read the documentation
after each field about the parameter you have to use.
Please use the following shortcode to add an iframe to your page:
[advanced_iframe securitykey="eaa4ba356ec483b7b1d5356ba6bc84157c58292f"]
You can also generate a shortcode which does include all settings
as shortcode attributes. This shortcode does not use any of the
defaults.
Copy the following shortcode to your page:
[advanced_iframe securitykey="eaa4ba356ec483b7b1d5356ba6bc84157c58292f"]
Examples if you want to use several iframes with different settings. Also read the FAQ:
- [advanced_iframe securitykey="eaa4ba356ec483b7b1d5356ba6bc84157c58292f" src="http://www.tinywebgallery.com"]
- [advanced_iframe
securitykey="eaa4ba356ec483b7b1d5356ba6bc84157c58292f"
src="http://www.tinywebgallery.com" width="100%" height="600"]
- [advanced_iframe
securitykey="eaa4ba356ec483b7b1d5356ba6bc84157c58292f"
src="http://www.tinywebgallery.com" id="iframe1" name="iframe1"
width="100%" height="600" ]
Get support
Advanced iFrame Pro - Get support
The settings above are the settings a normal iframe solution does
offer. They don't require any specific html, css or programming knowhow.
The advanced options below do modify the styles of the parent
page, the iframe, do some Javascript magic when the iframe is loaded or
include content directly to your page. Understanding this is not basic
Wordpress knowhow and therefore you can get help here if you want. I do
offer paid support for this plugin now.
What do you get?
- - Free check if you can include the content the way YOU like.
- - Fast and reliable setup of what you want.
- - You only pay if it works!
This offer is only available for Advanced iFrame Pro users.
If you are interested please visit http://www.tinywebgallery.com/blog/advanced-iframe-support/ for more information.
Advanced settings
Advanced iFrame Pro - Advanced settings
The following options are already features which are not html
standard anymore. All the options do already require additional
Javascript, css or dynamic processing.
Modify the parent page
Advanced iFrame Pro - Modify the parent page
With the following 3 options you can modify your template on the
fly to give the iframe more space! At most templates you would have to
create a page template with a special css and this is quite complicated.
By using the options below your template is modified on the fly by
jQuery. Please look at the screenshots to make these options more clear.
The options are very useful for templates that have a top navigation
because otherwise your menu is gone! If you still want to do this you
should add a back link to the page. The examples below are for Twenty
Ten, iNove and the default Wordpress theme.
With the next 2 options you can modify the css
of your parent page. The first option defines the id/class/element you
want to modify and at the 2nd option you define the styles you want to
change.
How to find the id and the attributes:- Manually:
Go to Appearance -> Editor and select the page template. Then you
have to look which div elements are defined. e.g. container, content,
main. Also classes can be defined here. Then you have to select the
style sheet below and search for this ids and classes and look which one
does define the width of you content.
- Firebug: For Firefox you
can use the plugin firebug to select the content element directly in the
page. On the right side the styles are always shown. Look for the
styles that set the width or any bigger margins. These are the values
you can then overwrite by the settings above.
- Small jquery help
Above you have to use the jQuery syntax:- - tags - if you want to hide/modify a tag directly (e.g. h1, h2) simply use it directly e.g. h1,h2
- - id - if you want to hide/modify an element where you have the id use #id
- - class - if you want to hide/modify an element where you have the class use .class
For more complex selectors please read the jQuery documentation.
Show only a part of the iframe
Show only a part of the iframe
Options if the iframe is on a different OR the same domain
You can only show a part of the iframe. This solution DOES WORK across
domains without any hacks! This is a solution that works only with css
by placing a window over the iframe which does a clipping. All areas of
the iframe that are not inside the window cannot be seen. Please specify
the upper left corner coordinates x and y and the height and width that
should be shown. Specify a fixed height and width in the iframe options
at the top for optimal results! Simply select the area you want to show
with the graphical area selector! Please go to the pro demo
for some working examples. Please also check the 5 options below. These
are the advanced features to handle changes in the iframe
With the following 5 options you can do
something when the page in the iframe does change. The parent page does
only know the url of the iframe that is loaded initially. This is a
browser restriction when the pages are not on the same domain. The
parent only can find out when the page inside does change. But it does
not know to which url. So the options below rely on a counting of the
onload event. But for certain solutions (e.g. show only the login part
of a page and then open the result page as parent) this will work.
Modify the content of the iframe if the iframe page is on the same domain
With the following options you can modify the content of the iframe. IMPORTANT: This is only possible if the iframe comes from the same domain because of the same origin policy of Javascript.
If you can use the workaround like described below you can also use this setting if you upgrade to the pro version.
Please read the section "
How to find the id and the attributes"
above how to find the right styles. If the content comes from a
different domain you have to modify the iframe page by e.g. adding a
Javascript function that is then called by the onload function you can
set above or you add a parameter in the url that you can read in the
iframe and display the page differently then. You should also use the
external workaround to modify the iframe if your page loads quite slow
and you see the modifications on subsequent pages. The reason is that
the direct modification can only be done after the page is loaded and
the "Hide until loaded" is only working for the 1st page. The external
workaround is able to hide the iframe until it is modified always and
also css can be added to the header directly.
With the next 2 options you can modify the css of your iframe if it is on the same domain.
The first option defines the id/class/element you want to modify and at
the 2nd option you define the styles you want to change.
With the next 2 options you can modify the target of links in your iframe if
it is on the same domain.
Resize the iframe to the content height/width
Resize the iframe to the content height/width
Options if the iframe is on the same domain
PLEASE READ THIS FIRST:
Only if the content from the iframe comes from the same domain
it is possible that the onload attribute can execute Javascript
directly which does e.g. resize the iframe to the height of the content
or scroll the parent window to the top.
If this is the case you can
use the settings below. If you want to include an iframe from a
different domain please read the how-to "Enabling cross-site scripting
XSS via an iframe" below where I explain how this can be done if you can
modify the web site that should be included. So if you are on a
different domain and cannot edit the external iframe page no interaction
between parent and iframe is possible!
Resize hidden iframes on tabs
Elements that are hidden with display:none return a size of 0
when the height is measured. This is very often the case when tabs are
used and you place an iframe on a tab that is not shown by default. The
next settings are needed for a workaround that moves the hidden element
out of the viewport, shows and measures the iframe and moves everything
back. To get this working you need to provide the id or class of the tab
that is hidden and depending on the tabs plugin also the id or class of
the tab that is visible by default to get the correct width. Please
read the section "How to find the id and the attributes"
above how to find the right id or class. E.g. Tabby Responsive Tabs and
Post UI Tabs work fine with this solution. Even nested tabs do work! If
you need a custom solution please contact me for an offer.
IMPORTANT: If you use this feature with the external workaround
you NEED to set a resize delay because otherwise the height is measured
while the element is still hidden. This can be done by setting "var
onload_resize_delay = 200;" before the external workaround script.
Depending on the size of your page you might have to increase this
value. As the tab is hidden this should not be a problem. For details
please see here.
Please note: Check the lazy load feature! It does also support
hidden tabs and is maybe the better solution as you only load the iframe
when it is really visible.
Please note: This feature is not supported for responsive iframes
because the size of the hidden tabs are not calculated at each resize.
External workaround: Howto enable cross domain resize and modification
Howto enable cross domain resize and modification
Solution if the iframe is NOT on the same domain: Enabling cross-site scripting XSS via an iframe
You need to be able to modify the external web page you want to have in the iframe to use the workaround!
Show me more infos how this works.
If the parent site and the iframe
site are NOT on the same domain it is only possible to do the above
stuff by including an additional iframe to the remote page which than
can call a script on the parent domain that can then access the
functions there. A detailed documentation how this works is described
here:
http://www.codecouch.com/2008/10/cross-site-scripting-xss-using-iframes - This plugin does wrap everything that is described there. Simple follow the steps below.
The following steps are needed:
- The parent page has a Javascript function that resizes the iframe
- The external iframe page has an additional hidden iframe, an onload attribute at the body and a javascript function
- A page on the parent domain does exist that is included by the hidden iframe that calls the function on the parent page
Everything is already prepared that you need on the parent
domain. For the remote page the Javascript file ai_external.js is
generated when you save the settings which you have to include into your
external iframe page:
- Add the following Javascript to the external web page
you want to have in the iframe (The optimal place is before the
</body> if possible. Otherwise put it in the head section. NEVER
place it just after the <body> as than the height of the script
element would be measured!):
<script src="http://yourdomain/path/ai_external.js"></script>
Show me what the Javascript does
The Javascript does the following:
- Adds "aiUpdateIframeHeight()" to the onload event of the page
- Modifies the remote iframe page (pro version only)
- Please see below how to configure this.
- Adds the iframe dynamically
- Adds a wrapper div below the body if needed
- Removes any margin, padding from the body
- Adds a temporary overflow:hidden to the body to avoid scrollbars
-
Enable the workarounds you want to use below.
Please note: If you change the settings above make sure to do a full reload the page in the iframe!
Please test with all browsers! If the wrapper div
is needed (It has a transparent border of 1px!) and it causes layout
problems you have to remove the wrapper div in the Javascript file and
you have to measure the body. The alternative solution is stored as
comment in the Javascript file. The Javascript file is regenerated each
time you save the settings on this page.
The workaround only supports one iframe on one page currently.
How to configure the "Modifies the remote iframe page" options
The configuration which is rendered by default to the Javascript is the one you enter in the settings above at "Modify the content of the iframe if the iframe page is on the same domain".
How to configure the workaround to work with different settings for different iframes
The file ai_external.js is created when you save the settings.
If you want to have different settings for different pages you can define the parameters which are used
in the script before you include the file ai_external.js.
The following parameters can be used:
Show me the parameters.
- iframe_id - By default the id from the settings are used.
If you want to use several iframes on the same page with the external
workaround you need to specify the id from the shortcode.
- updateIframeHeight - Enable/disable the resize height workaround. Valid values are "true", "false".
- keepOverflowHidden - Enable/disable if the overflow:hidden is kept. Valid values are "true", "false".
- hide_page_until_loaded_external - Enable/disable that the page is hidden until fully modified. Valid values are "true", "false".
- iframe_hide_elements - See Hide elements in iframe.
- onload_show_element_only - See Show only one element
- iframe_content_id - See Content id in iframe
- iframe_content_styles - See Content styles in iframe
- change_iframe_links - See Change iframe links
- change_iframe_links_target - See Change iframe links target
- onload_resize_delay - See Resize delay.
This setting is not stored in ai_external.js as default because if you
enable the external workaround this setting is disabled above because of
configuration inconsistencies! So this setting has to be done in the
external page. e.g. var onload_resize_delay=100; means 100 ms resize
delay. You also need this setting when you use the hidden tabs feature.
- iframe_redirect_url - Defines an url which is loaded if the page is not included in an iframe. See "Iframe redirect url" above.
- write_css_directly - See "Write css directly" above. Valid
settings are write_css_directly="true" or write_css_directly="false".
- additional_js_iframe - The ai_external.js can also write
additional Javscript. This is loaded at the end of ai_external.js. The
advantage using this is that the Javascript is only loaded if the page
is inside the iframe and is not loaded when accessed directly.
- additional_js_file_iframe - The ai_external.js can also
load an additional Javascript file. This is loaded at the end of
ai_external.js. The advantage using this is that the file is only loaded
if the page is inside the iframe and is not loaded when accessed
directly. Please note that the file is loaded asynchronously.
- resize_on_element_resize - See "Resize on element resize"
- resize_on_element_resize_delay - See "Poll intervall for the resize detection"
- iframe_url_id - See "Add the id to the url of the iframe"
- element_to_measure - You can define the element you want
to measure + a offset for fix content. This is sometimes needed for some
themes where e.g. chrome returns 0 as height.
- element_to_measure_offset - The offset for a fix content
An example would look like this:
<script>
var updateIframeHeight = "true";
var keepOverflowHidden = "false";
var hide_page_until_loaded_external = "true";
</script>
<script
src="http://yourdomain/path/ai_external.js"></script>
Important: If you want to include one
external page into more than one iframe only one configuration for the
external page is possible. You need to include the script from every
parent page that the resize callback is done properly. If you have
different configurations they overwrite each other and you will get an
unexpected result. If you need more complex configurations like this I
recommend to get the professional support offered for this plugin
because then an indivitual solution has to be designed and a custom
version of the plugin would be needed.
New 6.3 - Config files for the external workaround
Defining the variables before the script has the disadvantage that
you need to modify the html of the remote domain for every change and
also the code there can get really big. Therefore it is now possible to
use config files which are located on the parent server and loaded
dynamically from the external_ai.js. Config files have to be placed in
the root folder of the plugin (where advanced-iframe.php is located) and
need to follow this naming convention:
ai_external_config_<config_id>.js. This file does contain exactly
the variables described before. Then you need to add the config_id as
parameter to the external_ai.js like this:
..../ai_external.js?config_id=<config_id>. The config_id can only
contain alphanumeric characters, - and _.
You can also include the config file directly before the
ai_external.js script. This gives you the same flexibility but you have
to include 2 scripts. The performance including this directly is a
little bit better because no internal loading has to be done!
Show me the example above with a config file
In this example the config_id "example" is used.
- First create a file called "ai_external_config_example.js" in
the main folder of the plugin where the advanced-iframe.php file is and
save the following lines there:
var updateIframeHeight = "true";
var keepOverflowHidden = "false";
-
a. Add the parameter ?config_id=example to the external_ai.js
<script
src="http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/ai_external.js?config_id=example"></script>
or
b. <script
src="http://localhost/wordpress32/wp-content/plugins/advanced-iframe/ai_external_config_example.js"></script>
<script
src="http://localhost/wordpress32/wp-content/plugins/advanced-iframe/js/ai_external.js"></script>
-
Done. Make sure that you refresh the browser cache if you make changes to your config file. Example 7 shows a working setup.
Add additional files
Add additional files
All settings above are designed for smaller changes of the parent or the iframe. If you want to make bigger changes and you are able to store this in a file including a whole file is the better solution. Below you can add additional Javascript or css files to the different pages.
Parent
For some features in iframes additional css or js files are needed in the parent(!) page. E.g. for the newest version of lytebox this is needed. Each of the files do get a version number which is randomly changed each time you save the settings. So if you change the css or the js file you should save the settings to make sure your users to get the new version right away and not a chached one. If you need to add css or Javascipt to the iframe please check the settings of the external workaround.
Iframe
You can also include a css file directly into the iframe page. This setting is also saved in the external workaround file. In the external workaround file the settings below are written at the place where the ai_external.js is included!
Include content directly
Include content directly
You can also include content directly with jQuery. The page is loaded
and the part you specify below is included by Javascript into the page.
The cool thing is that you can specify an id or a class which specify
the content area that should be included. This feature does only work if
the page is loaded from the SAME domain. If you use the setting below no iframe is used anymore. So only include stuff that is for display only.
Please
note: Loading the external content is done after the page is fully
loaded and takes some time. Therefore some extra settings below are
possible to make the integration as invisible as possible. The included
div has the id ai_temp_>iframe_name<. So if you need to overwrite
some css you can put it in an extra file and add this in the section
"Additional files"
Small jQuery help
Small jQuery help
You can use jquery selector patterns directly to identify the
elements you want to modify at some of the settings. This plugin does
use this selectors than at the right place. This is already an advanced
topic if you are not familiar with jQuery.
Show me a small jQuery selector help.
I have created a small jquery selector help which is optimized for
the advanced iframes scenarios. It is an extract from
http://refcardz.dzone.com/refcardz/jquery-selectors#refcard-download-social-buttons-display.
So please go there if you need an extended version or give someone
credit.
What are jQuery selectors?
jQuery selectors are one of the most important aspects of the
jQuery library. These selectors use familiar CSS syntax to allow page
authors to quickly and easily identify any set of page elements to
operate upon with the jQuery library methods. Understanding jQuery
selectors is the key to using the jQuery library most effectively. The
selector is a string expression that identifies the set of DOM elements
that will be collected into a matched set to be operated upon by the
jQuery methods.
Types of jQuery selectors?
There are three categories of jQuery selectors: Basic CSS selectors, Positional selectors, and Custom jQuery selectors.
The Basic Selectors are known as "find selectors" as they are used to
find elements within the DOM. The Positional and Custom Selectors are
"filter selectors" as they filter a set of elements (which defaults to
the entire set of elements in the DOM). This extract only shows the
basic selectors as they are most important and will cover most of your
needs.
Basic CSS Selectors
These selectors follow standard CSS3 syntax and semantics.
Syntax |
Description |
* |
Matches any element. |
E |
Matches all elements with tag name E. |
E F |
Matches all elements with tag name F that are descendants of E. |
E>F |
Matches all elements with tag name F that are direct children of E. |
E+F |
Matches all elements with tag name F that are immediately preceded by a sibling of tag name E. |
E~F |
Matches all elements with tag name F that are preceded
by any sibling of tag name E. |
E:has(F) |
Matches all elements with tag name E that have at least one descendant with tag name F. |
E.c |
Matches all elements E that possess a class name of c.
Omitting E is identical to *.c. |
E#i |
Matches all elements E that possess an id value of i.
Omitting E is identical to *#i. |
E[a] |
Matches all elements E that posses an attribute a of any value. |
E[a=v] |
Matches all elements E that posses an attribute a whose value is exactly v. |
E[a^=v] |
Matches all elements E that posses an attribute a whose value starts with v. |
E[a$=v] |
Matches all elements E that posses an attribute a whose value ends with v. |
E[a*=v] |
Matches all elements E that posses an attribute a whose value contains v. |
Examples
- $("div") selects all <div> elements
- $("fieldset a") selects all <a> elements within
<fieldset> elements
- $("li>p") selects all <p> elements that are direct children of <li> elements
- $("div~p") selects all <div> elements that are preceded by a <p> element
- $("p:has(b)") selects all <p> elements that contain a <b> element
- $("div.someClass") selects all <div> elements with a class name of someClass
- $(".someClass") selects all elements with class name someClass
- $("#testButton") selects the element with the id value of testButton
- $("img[alt]") selects all <img> elements that possess an alt attribute
- $("a[href$=.pdf]") selects all <a> elements that possess an href attribute that ends in .pdf
- $("button[id*=test]") selects all buttons whose id attributes contain test
You can create the union of multiple disparate selectors by
listing them, separated by commas. For example, the following matches
all <div> and <p> elements: div,p
Advanced iframe browser detection
Advanced iframe browser detection
Pro users can now specify browser specific iframes. This is
imporant especially for the "Show only part of the iframe" feature where
browser differences of a few pixels can matter. But you can use this
for other things as well because mobile, iphone, ipad can also be
detected.
Show me how to configure the browser detection in advanced iframe pro.
Modern website designs are not pixel based anymore and
depending on the features of the browser they also look slightly
different. So if you use the "Show only part of the iframe" feature it
is possible that the area you want to cut out of the website is at a
slightly different place. You can also use the browser detection to show
different iframes for different browsers or even mobile devices.
Setup
If you want to have different iframe configurations depending on the browser you have to use the shortcode attribute browser="" and define the browsers there which should be used for this shortcode. See the different configuration options
below. You can define several browsers by separaring them by, and even
define browser versions by adding the versions with (version). Each of
the shortcodes which are browser dependent need to have the same id!
The last shortcode should have the attribute browser="default". This is
then used if no browser does match before. If you don't do this you can
show iframes only for a specific browser.
Example 1 - Special settings for IE 10 and IE 11
[advanced_iframe securitykey="xxx" id="example1" show_part_of_iframe_x="25" browser="ie(10),ie(11)"]
[advanced_iframe securitykey="xxx" id="example1" show_part_of_iframe_x="20" browser="default"]
Example 2 - Special settings for IE, Firefox and Chrome
[advanced_iframe securitykey="xxx" id="example2" show_part_of_iframe_x="25" browser="ie"]
[advanced_iframe securitykey="xxx" id="example2" show_part_of_iframe_x="23" browser="firefox,chrome"]
[advanced_iframe securitykey="xxx" id="example2" show_part_of_iframe_x="20" browser="default"]
Example 3 - Show a different iframe on iframe on apple devices and mobile devices
[advanced_iframe securitykey="xxx" id="example3" src="apple iframe" browser="iphone,ipad,ipod"]
[advanced_iframe securitykey="xxx" id="example3" src="other mobile devices iframe" browser="mobile"]
[advanced_iframe securitykey="xxx" id="example3" src="normal iframe" browser="default"]
Configuration options
The following options for most common browsers can be used:
- ie - Selects all versions of Internet Explorer. Also a version is supported. ie(10) selects IE10, ie(11) selects IE11
- safari - Selects all versions of Safari. Also a version is supported. Add the version in (). e.g. safari(5)
- firefox - Selects all versions of Firefox. Also a version is supported. Add the version in (). e.g. firefox(20)
- chrome - Selects all versions of Chrome. Also a version is supported. Add the version in (). e.g. chrome(25)
- opera - Selects all versions of Opera. Also a version is supported. Add the version in (). e.g. opera(20)
- ipad - Selects all versions of ipad.
- ipod - Selects all versions of ipod.
- iphone - Selects all versions of iphone.
- mobile - Selects all mobile devices.
- tablets - Selects all tablet devices.
- android - Selects all android devices.
- androidtablet - Selects all android tablet devices.
- default - Is used if no other advanced iframe pro with the same id was selected before.
Credit and update
Advanced iFrame Pro uses an integrated browser detection which is based on the wordpress plugin "php-browser-detection 2.2.3" and the browser detection file (5033, 23 Sep 2014) from browscap.org.
You can get an updated version of the browsercap.ini file here: http://tempdownloads.browserscap.com/
or the latest version here: http://browscap.org/
If you want to update the browser detection file get the
php_browscap.ini from there and rename it to
php-browser-detection-browscap.ini.
Or always get the latest version of the advanced iframe pro plugin. This file is also updated there!
Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader
Wordpress Flash Uploader, TinyWebGallery, Joomla Flash Uploader
This plugin is the extract for the iframe wrapper which was
written for the TinyWebGallery. I needed an iframe wrapper that could do
more than simply include a page. It needed to pass parameters to the
iframe and modify the template on the fly to get more space for TWG. If
you want to integrate TWG please use the "TinyWebGallery wrapper". It
offers specific features only needed for the gallery. I hope this
standalone wrapper is useful for other Wordpress users as well.
Please take a look at my other projects: Wordpress Flash Uploader,
TinyWebGallery, Joomla Flash Uploader or TWG Flash Uploader. If you
like TWG or one of my other projects like JFU, WFU or TFU you should
consider registering, because you can use all products with one single
license, get all features of the gallery and a complete upload solution
as well.
Please go www.tinywebgallery.com for details.