Create Instant Loading Mobile Websites with AMP

Today, people consume tremendous amount of information on their smartphones. However,
loading websites on our mobile devices is a slow and frustrating experience for many of us. What if there was an option to optimize website content to suit the mobile web? Articles, sites, and blogs would be loaded instantly!

Introducing AMP or Accelerated Mobile Pages—a technology that is open source, free of cost, and freely available to everyone under the Apache License.

Understanding AMP

Fruit of the AMP Project, AMP includes three main components, which are:

  • AMP HTML
  • AMP JS
  • Google AMP Cache

AMP HTML

This is regular HTML extended with some additional properties. AMP HTML adds some of its own custom HTML tags to help implement common patterns in a faster way.

AMP JS

This is the library that implements all the best performance practices of AMP to ensure high-speed rendering of webpages.

Google AMP Cache

This is a Google CDN network for delivering AMP documents. It fetches AMP pages and caches them to improve performance.

Trying Out AMP

AMP HMTL is not a completely new technology. It is built over the existing HTML, CSS, and JS. However, it restricts certain features of the current implementations of HTML, CSS, and JS to achieve the required performance. The following sample shows how to create an AMP compliant HMTL file.

You will see that most of the tags used in the sample are regular HTML tags. However, AMP does restrict some parts of HTML, CSS, and JavaScript. For instance, the image tag cannot be used in an AMP file. So instead, we have to go in for an enhanced AMP HTML tag.

To validate your AMP page, check out the guide on the AMP Project website.

OK, So How Exactly Does AMP Make Pages Fast?

There is a big set of carefully designed optimization techniques that are fundamental to the creation of AMP.

  1. JavaScript delays page load. So, AMP pages do not allow user-written JavaScript. Instead, AMP provides custom AMP elements to implement most commonly used JS activities.
  2. External resources, such as images, need to specify their size in the HTML. This helps AMP to know the size of these resources beforehand and create the entire page layout in a single HTTP request. In effect, it avoids expensive style recalculations and improves performance.
  3. AMP allows only inline CSS in order to reduce HTTP requests and limits the CSS size to 50KB to reduce redundant unwanted styles from being written.
  4. There is no blocking for downloading web fonts and they are downloaded before any other HTTP requests are processed.
  5. AMP reads all of the DOM elements before writing them. This way, it minimizes style recalculations and any overheads associated with it.
  6. AMP allows only GPU accelerated animations. This way, it reduces the performance lost by animations that are executed by the browser instead of GPU.
  7. AMP prioritizes the resource downloads by downloading only what’s needed. It, however, processes them in advance. It keeps the resource with it and shows it only when it’s needed. For instance: During a page load, images are downloaded only if they are likely to be seen by the user or if the user is likely to scroll down.

What About Browser Support?

According to the AMP Project website, AMP supports the latest two versions of browsers such as Chrome, Firefox, Edge, Safari, and Opera. This includes desktop, phone, tablet as well as the web view version of these browsers.

Alright, What Else Should You Know?

If you are interested, you could participate and contribute to AMP.

To understand how AMP unfolds and to know the future plans, you can check out the roadmap.

As for success stories:

  1. WashingtonPost increased returning users by more than 23% with 88% improvement in load time. It has also improved its reader retention rate.
  2. Gizmodo saw 3x improvement in load time and a 50% increase in the impressions per page view.
  3. At Wired.com, the clickthrough rates (CTR) for ads improved by 63%.

You can find more in the AMP Project website.

To Sum Up

AMP has proved to be a game-changer for the publishing industry and things will only get better with coming releases. It might be a good strategy to be an early adopter and implement AMP in your static content platform as well. As they say, the early bird catches the worm.

You May Also Like