In response to an overwhelming amount of requests from developers, Naina Raisinghani, Product Manager for the AMP Project at Google, announced that web developers can now use the
<amp-script> component to add custom JS to their AMP pages.
<amp-script>lets you cover use cases that you couldn’t with existing AMP components. It also lets you share code across your AMP and non-AMP pages.
Raisinghani did list some constraints to
amp-script that are required to maintain AMP performance guarantees.
- Users must initiate changing page content
- Content cannot be altered by custom JS on page load
- The custom JS must be smaller than 150kB
- Only whitelisted APIs are supported
The addition of
amp-script will enable more sites to integrate AMP and will also make it possible for other sites to convert their entire site over to AMP.
It’s important to note that AMP is a collection of web components that are focused on performance. It’s also designed to keep a site from degrading over time as changes are made by to it by different developers. It is still possible to create and maintain sites that are equally as fast as AMP but AMP offers a highly structured and strict framework for achieving that.
Never miss an important story
Weekly news updates, no spam, and you can unsubscribe anytime.