iframe auto resize

2019-07-19 01:26发布

问题:

I have been desperatly searching the web for a way to auto resize an iframe. I have tried many scripts online, but most recieve a permission denied error.

Both sites are members of the same subdomain

site 1: (views iframe) sub.domain.site.ca site 2: name.site.ca

how is this done (both are members of 'site.ca')

回答1:

I think this is the exact answer you are looking for:

http://ofirpicazo.com/javascript/iframe-resizing-across-subdomains/



回答2:

If you are using jquery then you may put this code in the loaded page to auto resize your calling iframe :

$(document).ready(function(){
    $('#my_iframe', window.parent.document).height($(document).height());
});


回答3:

i implemented such a solution: http://www.amirharel.com/2009/07/28/implementing-iframe-toolbar/

i hope it helps.