amp-wp icon indicating copy to clipboard operation
amp-wp copied to clipboard

iframe width=100% changed to 0 - Can it be changed to "auto" instead?

Open ecairol opened this issue 7 years ago • 3 comments

Hi,

I've read other issues here and found similar questions, but not exactly what I'm looking for.

I'm aware that AMP doesn't support % values on width/height, AMP Console suggests using width=auto for these cases.

Is there a way to configure the plugin so that when an author enters a <iframe width="100%"> it gets translated into <amp-iframe width="auto"> ? I'd then use CSS to set the width to 100%.

What I'd like to avoid is compiling the width=100% to a width=0 which is causing errors in the AMP Console.

Thanks for you help! Esteban

ecairol avatar Oct 01 '19 17:10 ecairol

This has been implemented already in #2712 and was part of the 1.2.1 release.

Given this input:

<iframe src="https://example.org/" width="100%" height="300"></iframe>

The iframe sanitizer converts it into:

<amp-iframe src="https://example.org/" width="auto" height="300" layout="fixed-height" sandbox="allow-scripts allow-same-origin">
    <span placeholder="" class="amp-wp-iframe-placeholder"></span>
    <noscript><iframe src="https://example.org/" width="100%" height="300"></iframe></noscript>
</amp-iframe>

Is this not what you see?

westonruter avatar Oct 01 '19 17:10 westonruter

@westonruter thank you very much for the quick response. Let me corroborate the plugin version and get back to you. Thanks again!

ecairol avatar Oct 01 '19 18:10 ecairol

@westonruter we were running version 1.2.0

Upgrading the plugin to the latest version solved the problem indeed. Thank you very much.

ecairol avatar Oct 02 '19 14:10 ecairol