amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

amp-iframe resize not working

Open antipath opened this issue 10 years ago • 5 comments

Hi guys,

for the amp-iframe extended component if we leave out "allow-same-origin" value from the sandbox attribute, the amp-iframe does not resize.

What browsers are affected?

All browsers

Which AMP version is affected?

v. 1460655576651

antipath avatar Apr 29 '16 13:04 antipath

@antipath Do you have a sample document?

/to @sriramkrish85 PTAL.

dvoytenko avatar Apr 29 '16 15:04 dvoytenko

I have included the amp-iframe extended component js

and produced the following amp-iframe code

<amp-iframe sandbox="allow-scripts allow-top-navigation" layout="responsive" src="https://somedomain.com/amp/ampiframe.html" height="311" width="320" resizable="" class="poll-container -amp-element -amp-layout-responsive -amp-layout-size-defined -amp-layout" frameborder="0" id="AMP_16" scrolling="no" style="height: 311px;">

<i-amp-sizer style="display: block; padding-top: 0px;"></i-amp-sizer> <div overflow="" tabindex="0" role="button" aria-label="Read more">Read more!</div>

<i-amp-scroll-container class="amp-active"> <iframe class="-amp-fill-content" width="320" height="309" name="amp_iframe0" frameborder="0" scrolling="no" sandbox="allow-scripts allow-top-navigation" src="https://somedomain.com/amp/ampiframe.html"> </iframe></i-amp-scroll-container>

</amp-iframe>

then on the iframe page itself i have the following that post messages back to the parent

window.parent.postMessage(JSON.stringify({ sentinel: 'amp', type: 'embed-size', height: document.body.scrollHeight }), '*');

Thanks for your help! Vince

antipath avatar Apr 29 '16 16:04 antipath

@antipath i think your issue is similar to

https://github.com/ampproject/amphtml/issues/2940

Please go through our discussion on the bug and let me know if that helps.

camelburrito avatar Apr 29 '16 17:04 camelburrito

@sriramkrish85,

The issue resolves once I put in "allow-same-origin", I guess I should hosting my iframe on another subdomain and apply "allow-same-origin" to see if that works

antipath avatar Apr 29 '16 17:04 antipath

Closing this bug as this is a non issue

@ericlindley-g looks like we need to document this better or even remove the check for origin. Could you open a bug for this and we can discuss.

camelburrito avatar May 13 '16 21:05 camelburrito