Plugin Directory

Changeset 1511002


Ignore:
Timestamp:
10/09/2016 12:13:35 AM (9 years ago)
Author:
bseddon
Message:

Fix cross domain issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • responsive-thickbox/trunk/includes/utility-functions.php

    r1510354 r1511002  
    5252                <div id="product-list-wrap" style="width: 100%; height: 100%; display: inline-block; background-color: white; border: 1px solid #ccc;" ></div>
    5353                <script>
     54                    function receiveMessage()
     55                    {
     56                        if (event.origin !== "https://www.wproute.com")
     57                            return;
     58                       
     59                        // The data should be the outerheight of the iframe
     60                        var height = event.data + 0;
     61                       
     62                        var iframe = jQuery('#product-list-frame');
     63                        // Set a minimum height on the outer table but only if its not already there
     64                        var table = iframe.parents('table');
     65                        if ( table.height() > height + 30 ) return;
     66                        table.css( 'min-height', ( height + 30 ) + 'px' );
     67                    }
     68                    window.addEventListener("message", receiveMessage, false);
     69
    5470                    function iframeLoad(e)
    5571                    {
    5672                        var iframe = jQuery('#product-list-frame');
    57                         // Set a minimum height on the outer table
    58                         var table = iframe.parents('table');
    59                         var height = jQuery(iframe[0].contentDocument.body).height();
    60                         table.css( 'min-height', ( height + 30 ) + 'px' );
     73                        iframe[0].contentWindow.postMessage( "height", "https://www.wproute.com/" );
    6174
    6275                        // This is only for IE
Note: See TracChangeset for help on using the changeset viewer.