WordPress.org

Ready to get started?Download WordPress

Forums

Advanced iFrame
[resolved] Autoresize cross-domain only from small to large height? (16 posts)

  1. reis24
    Member
    Posted 10 months ago #

    Hi Michael,

    First, you did and still do a great job with this plugin! Thank you!

    Second, is it true that the autoresize for cross-domains only works to enlarge the height of the parent and not to shorten it? Unless you reload that parentpage again...

    My dummy-site you can find on http://www.edwinkonings.nl/test/, where the parent indeed is resizing the iframe from 1500px to 3000px and even to 5000px, but then back to 1500px the parent stays the same as to 5000px.

    Regards,
    Edwin

    http://wordpress.org/extend/plugins/advanced-iframe/

  2. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    o.k. can you add some debug in the ai.js?

    function aiResizeIframeHeightById(id, nHeight)
    should be called from the remote Javascript.

    Please add an
    alert(height);

    right after
    height = parseInt(nHeight) + aiExtraSpace;

    and check if the height is the one which is expected.

    The the other thing is: when/how is the size changed? you have the event for resize on the onload event. So when the page is made smaller by Javascript the resize is not called.

  3. reis24
    Member
    Posted 10 months ago #

    Thank you for your quick reply!
    I just added the debug to ai.js and I see that the height remains on 5122.

  4. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    o.k. Then it seems setting the body of the page to 1 does not work (this does work on the parent javscript).

    I would have to rebuild this scenario on my local system.
    The solution I have on the parent is to actually resize the iframe - measure the scroll height and then set the height.

    In your case you can measure the height of the div and use this for measuring...

  5. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    I tried to reproduce it.

    But I could not. If I use the same
    updateIframeHeight()
    as you do it work for me. Can you send me your setup?

    On my test setup it is resized smaller as well.

    I'm currently working on a solution where you only have to include a javascript and the iframe and everything else is created automatically.

  6. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    I can now reproduce it. I tested on my local host with the normal resize active which does of course work.

    The problem is the body that expands automatically.
    I play around now with an extra div which is measured.
    This works on my local test already but I have to check on all browsers now...

  7. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    Hi,

    I have a working solution now. Do you want to test it?

  8. reis24
    Member
    Posted 10 months ago #

    Sorry, this weekend I was not able to reply...
    Yes, I would like tot test it! :-)

  9. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    Please try this version:

    http://www.tinywebgallery.com/test/advanced-iframe-3.5.zip

    Please read the updated instructions in the file. Save the configuration once to get the the generated js file in the js folder.

  10. reis24
    Member
    Posted 10 months ago #

    This is what I did so far without the desired results:

    In wp-admin I deactivated and removed the plugin advanced-iframe 3.4.3. Then I uploaded the zip-file advanced-iframe 3.5 and I activated the plugin. I checked the "var domain=" in ai_external.js and that was OK.

    From each of the iframed files I removed the line before the </body>-tag:
    <iframe id="hiddenIframe" style="visibility:hidden;" width="0" height="0" src="http://www.edwinkonings.nl/test/wp-content/plugins/advanced-iframe/js/iframe_height.html">Iframes not supported.</iframe>.

    Also I also removed the call onload="updateIframeHeight()" in the <body>-tag.

    and I added between the <head> and </head>:
    <script>http://www.edwinkonings.nl/test/wp-content/plugins/advanced-iframe/js/ai_external.js</script>

    Then uploaded the iframed files and cleared the cache and reloaded the parent. What did I do wrong?

    I don't see the hidden iframe in the iframed pages with firebug.

  11. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    My mistake...

    <script src="http://www.edwinkonings.nl/test/wp-content/plugins/advanced-iframe/js/ai_external.js"></script>

    is the way how to include the script.
    And the best way for scripts is to add them before the </body> if not really needed before. This speeds up page loading.

  12. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    My mistake...

    <script src="http://www.edwinkonings.nl/test/wp-content/plugins/advanced-iframe/js/ai_external.js"></script>

    is the way how to include the script.
    And the best way for scripts is to add them before the </body> if not really needed before. This speeds up page loading.

  13. reis24
    Member
    Posted 10 months ago #

    OK, now it's working the way I want it to!
    Thank you for your help!

    Edwin

  14. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    ;) - and hopefully much easier to configure.

    Please also test on your target pages as well. Because I do modify the html now and please check if this causes any issue n your pages.

  15. reis24
    Member
    Posted 10 months ago #

    Even automatically scroll to the top is much easier to configure: you only have to select YES in the admin panel under Advanced iframe - Advanced options -> Javascript iframe onload options -> Scrolls the parent window to the top!

  16. mdempfle
    Member
    Plugin Author

    Posted 10 months ago #

    Really? I have to check if this is really allowed on all browsers.

Reply

You must log in to post.

About this Plugin

About this Topic