Ironically the amp page is artificially slow when blocking amp’s JS because they force an 8 second delay - via required boilerplate css - before content is visible.
Ironically the amp page is artificially slow when blocking amp’s JS because they force an 8 second delay - via required boilerplate css - before content is visible.
<style>
body { animation:-amp-start 8s steps(1,end) 0s 1 normal both}
@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}
</style>
<noscript>
<style amp-boilerplate>
body{animation:none}
</style>
</noscript>
See the noscript section: if javascript is disabled, the CSS displays the body immediately. If Javascript is enabled, but for some reason the AMP javascript fails to load, after 8 seconds, the page is displayed anyway. When the AMP Javascript loads (a single js file, one request, typically already in the users cache), the javascript displays the page immediately. The page is probably somewhat broken without the javascript loading, but the 8s is a fallback, not code to slow down non-javascript browsers.The only two cases where the 8s is relevant are: the network connection is so bad that the javascript file fails to load within 8s and the useragent has explicitly blocked the one javascript file on the page, without blocking javascript overall.
I mean, if the goal is to make the page display only once it's fully loaded, and the point of amp is to make pages load quickly, eight seconds seems gratuitous. Even slow sites load within eight seconds.
(I don't deliberately use any Google products, so I'm completely unfamiliar with amp.)
Until the javascript has loaded (a single cacheable javascript file: https://cdn.ampproject.org/v0.js ), the browser can't lay out the resources on the page (images for example).
If the browser rendered the page before layout, it would likely look pretty bad. Then when the javascript arrived, the document would layout again moving elements around. This is typically referred to as the "Flash of Unstyled Content" (https://en.wikipedia.org/wiki/Flash_of_unstyled_content) and is considered by some to be a negative user experience. Many web pages outside AMP take a similar approach to hiding the content until the layout has completed.
The 8 second CSS animation is only present as an "escape hatch" in case the javascript never loads. The specific value was chosen as a time that probably indicates the javascript will never load. Note that if javascript is disabled entirely, the page is rendered immediately via the <noscript> tag. There has been a discussion around changing the 8 second time to something shorter ( https://github.com/ampproject/amphtml/issues/22543 ), though it could probably be renewed.
Certainly an ad blocker can be used to block any URL, but I don't know of any that block this one by default. If there are any, let me know and I'm happy to file issues to get that fixed!
If a user chooses to block this particular resource which the page needs to load, then the page still loads after 8s.
Similarly, if the site owner chooses, they can run the AMP Toolbox optimizer (https://www.npmjs.com/package/@ampproject/toolbox-optimizer) which lays out the page server-side and removes this CSS flash for most documents. Some documents can't be laid out until the viewport size is known.
Some people don't want to load resources from Google's servers, and they shouldn't be punished for it. That JS file isn't needed for AMP pages to load. People don't need to load JS to read text and view images. I don't think there is any reasonable argument to have any users hit an 8-second delay.
One problem is that Google wants AMP to replace HTML. I've already seen AMP pages in the Google search results (on desktop), and at least one large website so far appears to be built entirely in AMP.[1]
Google already sends desktop users to Wikipedia's mobile site from some of their listings, so I wouldn't be surprised if Google eventually starts to send desktop users to AMP pages. Google benefits when people visit AMP sites, because Google will be able to spoof the domains and serve the content themselves, giving them increased control over publishers.
[1] independent.co.uk, but they removed the CSS that delays page loading.
The company is an advertising company. If 90+% of your revenue comes from one thing, that's what you are. Anything else is a gimmick.
That tech fanboys continue to ignore or refute this fact about Google just shows how much Kool aid they've consumed, I assume by skipping the drinking part and going straight to Kool Aid baths and Kool aid enemas.
Blocking third party resources on a site is not a "bug" that needs to be "fixed".
Unfortunately... https://www.opensecrets.org/orgs/summary.php?id=d000067823
That's out of date now, though; despite still being part of the required boilerplate CSS for AMP pages, I can't find that delay in any of the https://amp.dev/ pages (the ampbyexample.com replacement demo site).
This is really shady.
If you disable all js, there is no delay. If you specifically block amp js, there is a delay. There could certainly be a shady reason for this, but the justification makes sense: one of the goals of AMP is to have, basically, a single, correct, initial paint. That's why images are statically sized and amp sticks placeholders there until the real images load. The js delay exists to allow the site to fetch the js and use it to correctly render the initial paint, even on a slow/flaky connection where the js takes a bit to fetch.