Recently Google announced that you can add custom JavaScript to AMP pages. The amp script component can be utilized to permit user interactions as well as to share code across AMP enables plus non-AMP pages. AMP pages basically do not support custom JavaScript. AMP pages with custom JavaScript will not be authorized as an AMP page. It must be in the AMP format such as amp-script. This format has custom tags which are focused on resource loading plus make sure fast representation of AMP pages.
AMP provides the best solution for developers to build pages quickly and in a hassle-free manner. Some kinds of functionality are too customized to person utilize cases or need custom JavaScript. The AMP framework is growing to hold the needs and requirements with amp-script. The amp-script permits AMP developers to set up custom JavaScript which expands page features and provide a valid AMP. To add custom JavaScript to AMP pages the developers need following requirements
Why implemented it?
The AMP team said that it was one of the most demanded features from developers for using AMP. It permits web pages delivered through AMP to include many interactivity features which JavaScript offers. The amp-script element runs a custom JavaScript pages in a separate worker thread. Before announcing this update, AMP pages are more static which restrict its uses and enforced publishers to comprise features for visibility plus speed in search results.