Jonas Köritz Jonas Köritz - 6 months ago 27x
Javascript Question

Do AMP-HTML pages have to load the JavaScript library from

The documentation states that AMP HTML documents MUST

  • Contain a
    <script async src=""></script>
    tag as the last element in their head (this includes and loads the AMP JS library).

Does this actually mean that i can't serve an internal copy of this file (e.g. for use in a restricted network environment without internet access)?


To be a valid AMP document, you must use the <script async src=""></script> tag.

However, in a valid AMP document, you also can specify a canonical URL. Normally, the canonical URL is an HTML document that uses services that are not allowed by the AMP architecture (e.g. customized JavaScript such as Bootstrap JS for menus). You also could assign the AMP document to the canonical tag, and then serve it to folks who do not have unrestricted access to the internet (and hence the Google CDN).