J!Extensions Store™
Faq Can i add scripts or CSS files to AMP pages?

Can i add scripts or CSS files to AMP pages?

Created on:Saturday, 06 June 2015 00:00

No you can't. The AMP format is a very specialized HTML markup done to be rendered instantly when a user opens a page on a mobile device. For this reason it doesn't allow and doesn't support script files (javascript) or external CSS files.

Although this aspect limits the features and the interactions that a user may have with an AMP page, it's the main purpose of Google AMP. Having pages lightened by all external resources allows to obtain a dramatic reduction of the page load time.
Do not think to AMP pages as a mobile version of your website that should be fully functional, if you want this just rely on a common responsive template.

AMP pages must be thought and treated as very essential and specific pages directly indexed by search engines, on which mobile users land on directly from mobile SERPs to experiment a top level user experience because of the instant loading speed. Based on Google guidelines, AMP pages should mainly include news-like or blog-like contents in an essential format. Obviously there is nothing that prevents AMP pages from including for example products pages generated by an e-commerce extension, commonly well indexed.