iframe

Advanced Iframe ProiframeDonateGitHub

WordPress plugin: embed iframe into content.

Iframes are needed to embed video from youtube or to embed Google Map or just to embed content from external page.

WordPress removes iframe when you switch from "HTML" to "Visual" tab because of the security reasons.

So you can embed iframe code using this shortcode [iframe width="100%" height="480" src="http://player.vimeo.com/video/3261363"].

You also can use this shortcode to embed content via simple link: [embed_]http://www.youtube.com/watch?v=A3PDXmYoF5U[/embed] (without underscore '_')

shortcode is a WordPress core feature and based on oEmbed.

Parameters:

  • src - source of the iframe [iframe src="http://player.vimeo.com/video/819138"] (by default src="http://player.vimeo.com/video/819138");
  • width - width in pixels or in percents [iframe width="100%" src="http://player.vimeo.com/video/819138"] or [iframe width="640" src="http://player.vimeo.com/video/819138"] (by default width="100%");
  • height - height in pixels [iframe height="480" src="http://player.vimeo.com/video/819138"] (by default height="480");
  • scrolling - parameter [iframe scrolling="yes"] (by default scrolling="no");
  • frameborder - parameter [iframe frameborder="0"] (by default frameborder="0");
  • marginheight - parameter [iframe marginheight="0"] (removed by default);
  • marginwidth - parameter [iframe marginwidth="0"] (removed by default);
  • allowtransparency - allows to set transparency of the iframe [iframe allowtransparency="true"] (removed by default);
  • id - allows to add the id of the iframe [iframe id="my-id"] (removed by default);
  • class - allows to add the class of the iframe [iframe class="my-class"] (by default class="iframe-class");
  • style - allows to add the css styles of the iframe [iframe style="margin-left:-30px;"] (removed by default);
  • same_height_as - allows to set the height of iframe same as target element [iframe same_height_as="body"], [iframe same_height_as="div.sidebar"], [iframe same_height_as="div#content"]; (removed by default);
  • any_other_param - allows to add new parameter of the iframe [iframe any_other_param="any_value"];
  • any_other_empty_param - allows to add new empty parameter of the iframe (like "allowfullscreen" on youtube) [iframe any_other_empty_param=""];

500 thoughts on “iframe”

  1. Great plugin. I have one urgent issue which is that the plugin seems to call jQuery on a non secure way. Since I'm using the plugin for a page with SSL I need to find a way to have the plugin make it's calls using a secure URL. How can I do that? Thanks.

    Reply
    • What do you mean about "call jQuery on a non secure way"?
      Iframe plugin calls jQuery like this: wp_enqueue_script('jquery');

      Reply
      • Ok, so what's happening is that my formerly fully functional SSL page is registering as broken until I turn of the iframe plugin. It then works fine. Of the various calls the page makes, it appears that http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css is the one I can't track down and may be involved. It may not be an iframe plugin issue per se but I can't tell what else it could be since turning off the plugin resolves the issue. I'm happy to send you the URL privately if you'd be willing to take a look....

        Reply
  2. Hi. I'm trying to embed an astore from Amazon.com into a page. The code looks like

    [iframe src="http://astore.amazon.com/smallcontagar-20" frameborder="0" scrolling="no" width="90%" height="4000"][/iframe]

    The problem I'm having is that I'm not getting the full width of the display. There should be a main element with a sidebar on the right. What can I do to correct this?

    Reply
    • The only way you could solve it is sidebars.
      [iframe src="http://astore.amazon.com/smallcontagar-20" frameborder="0" scrolling="yes" width="90%" height="4000"]
      I don't know the ways you could change the content or styles of the page inside of iframe.

      Reply
  3. Hello,

    Love the plugin, it works amazingly. However I have two questions:

    1. Is it possible to set the horizontal scrolling to no? Most of the sites I put into the iframe works fine, however some sites overflow horizontally a bit when I set scrolling to yes, is there a way to disable horizontal scrolling?

    2. Some sites, when a new link directs to a new page, will result in breaking out of the iframe and loading a new page. Is it possible to force the site in the iframe to load new pages inside it?

    Thanks!!

    Reply
    • 1) There is no ability to set scroll only on one side. Iframe could have scroll on both or none sides.

      2) IMHO you cannot control the behavior of links inside of the Iframe because of security reasons. But I recommend you to google it, maybe someone already solved this problem.

      Reply
      • Hello,

        I love this plugin because it's what I've been looking for in a long time, however today I installed a plugin called Advanced Ajax Page Loader http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

        This plugin "ajaxifies" my pages. However however upon installation the plugin breaks the iFrame layouts in Firefox and Internet explorer, resulting in them losing their height=100% properties. Is there a way around this to allow iFrame to work properly in firefox/IE with height=100% but still having Ajax reloader?

        Thanks!

        Reply
        • IMHO [iframe height="100%"] does not work correct in all browsers and it is not the fault of "Advanced Ajax Page Loader".

          Reply
  4. Great plugin it works well. I have one issue with our site - new boat page - when viewing on an iphone the frame does not resize and runs off of the screen. Is there anything I can change to correct this.

    Thank you.

    Reply
    • You should set the width of iframe in percents:
      [iframe width="100%" src="..."]
      If this will not help, than IMHO it is the bug of the browser on iPhone and I don't know how to solve it.

      Reply
  5. Hey, is there a way to link to an iframe? I have a couple of links on a sidebar that link to an iframe on the main content and I'm not able to do it.

    I tried using the id parameter and then target="iframe_id" but it doesn't work.

    Thanks!

    Reply
  6. Hi,

    You Iframe plug-in is very nice., I have 1 question is it possible to fit in the external site to the borders within my wordpress?

    If I tried using the width adjustment as stated in the parameters you showed it will just cut off some part of the page or if to much it will exceed the border. Right now the only option i see is to enable scrolling. Any Idea? Thanks again

    Reply
    • Scrolling is the only way to show all content of the external site, because you cannot control styles of the page inside of the iframe.

      Reply
      • Yes you are correct. Thank you very much for your plugin. It is a very useful add-in to a website. I was able to adjust the borders of my themes so the iframe will fit exactly. Nice work. Keep it up.

        Reply
  7. I use iframe like this ; [iframe width="100%" height="480" src="http://mystiforpid.stiforpmovie.com/index/?SOURCE=IndoNetwork"]

    but I want the URL "http://mystiforpid.stiforpmovie.com" open in other window when be clicked. How to setting it?

    Reply
  8. Love the plugin. Simple to use, and provides functions other similar programs don't. One quick question: is there a way to disable autoplay? Thanks in advance for any help.

    Reply
    • You are welcome.
      There is no autoplay parameter in iframe so I suppose you are talking about parameter of Vimeo or some other web-service.
      If you are talking about Vimeo, than try to use this shortcode:
      [iframe src="http://player.vimeo.com/video/3261363?autoplay=0"]
      If you are talking about some other web-service, then try to find similar param on their support pages.

      Reply
  9. Even with the default scrolling="no" you can scroll the iframe with the mouse wheel ... how can I fix this problem, so scrolling with the mouse wheel is disabled?

    thanks!

    best greetings from Germany

    Reply
    • I tested all major browsers and could not reproduce this bug.
      Which browser (version) and OS (Win, Mac, Linux) are you using?
      What site (page src) are you trying to embed?
      IMHO it is browser bug and I don't know how to solve it.

      Reply
    • IMHO it is not possible. You cannot access via javascript to objects on different domain because of security reasons.
      But you may also google it and maybe you will find some more info about it.

      Reply
  10. Hey, I am building a website for a real estate agent. I can't get the iframe to stay on the page, it keeps jumping to realtor.ca. I am using the following code [iframe width="100%" height="480" src="http://www.realtor.ca"].

    Reply

Leave a Comment