Using Sub domains with Advanced iFrame

By default you can not execute Javascript on different domains because of browser cross domain security restrictions. Advanced iFrame does use Javascript a lot for features like auto height. As solution advanced iframe has the external workaround which enables most of the local features also on the remote page.

If your iframe is on a sub domain also an easier way is possible. You still have to include one line of Javascript but the whole configuration is than like you are on the same domain and all settings can be done by shortcode.

To enable this you need to set the value “document.domain” to your main domain with Javascript. The plugin does set this value on the parent (from version 7.0.2 on) if you enable this in the administration. You can also set this manually as this version is not released yet.

If your iframe is on subdomain.example.com and your WordPress site is on www.example.com you have to add

<script>
document.domain=’example.com’;
</script>

anywhere to the source code of your page of the iframe. On the parent page the plugin already does this for you.

After you have done this you can configure Advanced iFrame like you are on the same domain.

See https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy for the documentation of this setting.

See example 42 where this way is used. Example 6 shows the same example with the “old” external workaround.

Have fun using Advanced iFrame,
Michael

Comments are closed, but trackbacks and pingbacks are open.