amp-iframe resize not working
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 Do you have a sample document?
/to @sriramkrish85 PTAL.
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 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.
@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
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.