amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

CSS truncated at 10000 characters

Open JoyceBabu opened this issue 8 years ago • 12 comments

Please only file bugs/feature requests for AMP here.

What's the issue?

I am not sure whether this a Google issue or AMP issue. Some times I find that our webpage layout is completely broken. I checked the css inside the rendered amp page and found that the CSS is truncated at 10000 characters.

https://www.google.co.in/amp/s/www.prokerala.com/astrology/thirumana-porutham.php%3famp=1


Expected Output

www prokerala com_astrology_thirumana-porutham php_amp 1 1


Actual Output

www google co in_search_q thirumana porutham oq thirumana poru aqs chrome 0 35i39j69i60j69i57j69i60j0l2 7546j0j4 sourceid chrome ie utf-8


How do we reproduce the issue?

Source Page Google Version

What browsers are affected?

I have noticed this mostly when browsing with desktop version of Google Chrome in responsive mode. If I open it in Chrome Mobile, it will be working correctly.

Which AMP version is affected?

JoyceBabu avatar Aug 10 '18 17:08 JoyceBabu

This is due to the source page truncating their CSS.

jridgewell avatar Aug 10 '18 17:08 jridgewell

The CSS is not truncated on the source page.

JoyceBabu avatar Aug 11 '18 04:08 JoyceBabu

to @jgluk

aghassemi avatar Aug 14 '18 18:08 aghassemi

Tracked internally: b/112595237

jgluk avatar Aug 14 '18 18:08 jgluk

I can't reproduce. The CSS appears identical to me.

The document loaded at the "Google version" link is in an iframe. Are you sure you aren't looking at the CSS of the outer frame instead.

Gregable avatar Aug 14 '18 20:08 Gregable

I had opened the frame source url directly and took the CSS from there. The CSS was truncated at 10000 characters and had an ellipse character following it.

JoyceBabu avatar Aug 15 '18 04:08 JoyceBabu

I find it unlikely this is the AMP Cache and I don't see the same when I look in the cache. If it's transient, it's very unlikely to be related to the AMP Cache code.

Could your server be doing this for some requests, or any other intermediary (ex: a CDN?)

Gregable avatar Aug 15 '18 18:08 Gregable

If the issue happens again, I will update here. Closing for now. Thank you.

JoyceBabu avatar Aug 16 '18 06:08 JoyceBabu

I think this is somehow related to AMP Cache.

screen shot 2018-08-22 at 5 40 15 pm

As you can see in the screenshot above, the page rendered within the iframe is broken. But the preview of the html returned from cdn.ampproject.org is rendering correctly.

To ensure that it is not caused by a Chrome extension, I had opened a new chrome instance with an clean profile directory for taking the screenshot.

JoyceBabu avatar Aug 22 '18 12:08 JoyceBabu

This is due to @media (min-color: 8) which, strangely, doesn't match when inside the iframe after render.

So, not an issue with the AMP Cache, but likely something in AMP Core.

jridgewell avatar Aug 22 '18 16:08 jridgewell

Actually, it seems render has nothing to do with it. By the time the AMP Core JS loads, it already fails to match the (min-color: 8) media.

jridgewell avatar Aug 22 '18 16:08 jridgewell

This is a Chrome bug with cross-origin iframes and min-color media queries. Moving to https://bugs.chromium.org/p/chromium/issues/detail?id=876760.

jridgewell avatar Aug 22 '18 16:08 jridgewell