5 ms·
You actually have to make it deliberately slow if Google's js is disabled? that seems a little malicious...
by psandersen 7y ago
You actually have to make it deliberately slow if Google's js is disabled? that seems a little malicious...
- hadrien01 7y agoYup. This snippet adds a css animation to make the page white for 8s, and it's stopped by Google's JS or the browser's noscript (which you don't enable if you only block Google's JS and not the domain JS): https://amp.dev/fr/documentation/guides-and-tutorials/learn/spec/amp-boilerplate https://amp.dev/fr/documentation/guides-and-tutorials/learn/...
- amirmasoudabdol 7y agoSo, is there a way that I can block this tag somehow and drop it during the load time?
- hadrien01 7y agoYou can add a Stylus stylesheet enabled for the regex .[star]amp.[star] (replace [star] with the star symbol) that contains body{animation:none}, but I don't know if that's good for performance. Edit: Developers can also add that css in their amp style, and it seems to be accepted by the amp validator. AMP devs, you know what to do! ;)
- TazeTSchnitzel 7y agoBtw you can begin a line with two spaces for code formatting: .*amp.*
- chrismorgan 7y agoGo for this on all pages instead: html[\26a1] body, html[amp] body { animation: none; } (I wrote \26a1 because HN doesn’t allow the literal U+26A1 character.) That way it applies to all AMP pages, regardless of their URL, and doesn’t clobber any other pages (though I can’t actually imagine any genuine animation on a body element).
- hadrien01 7y agoWorks perfectly, thank you! I took the liberty to put it on userstyles.org for one-click install: https://userstyles.org/styles/171953/disable-amp-blank-loading https://userstyles.org/styles/171953/disable-amp-blank-loadi...
- rogual 7y agoInsane. Google has lost all credibility.
- TazeTSchnitzel 7y agoI assume the idea behind it is to prevent the “flash of unstyled content”.
- sanbor 7y agoI wonder who made the decision that 8s delay is better than the unstyled flash.
- echeese 7y agoThere is no delay if the script loads properly.
- TazeTSchnitzel 7y agoConsider a very slow network connection. Is effectively delaying the page loading for 8 seconds worth it?
- echeese 7y agoNo, but I didn't say it was was a good idea
- deleted 7y ago[deleted]
- JohnFen 7y agoHaving the delay in that circumstance is much, much worse than a FOUC.
- echeese 7y agoI agree
- Wowfunhappy 7y agoFlashes are distracting. IMO, it's not the delay that's the problem, but the fact that it lasts eight seconds. The limit should be 500 milliseconds, at most.
- randomguy7788 7y agothe original code is to prevent FOUC, that 8 second delay is sort of a fallback if the js hasn't unhidden the body