Problem
The Google AMP validator fails when you include the Browser agent in HTML pages formatted for Google's Accelerated Mobile Pages (AMP) project.
For example, you may see a validation error that says:
The tag 'script' is disallowed except in specific forms.
Solution
To successfully validate your AMP pages and avoid the error message, set the following for your AMP pages:
- Enable the Browser monitoring for AMP on your AMP pages.
- Disable the Browser monitoring agent on your AMP pages.
This ensures that AMP pages validate successfully and that the Browser agent continues to monitor your non-AMP pages.
Cause
According to the AMP spec, HTML pages formatted for the AMP project are not allowed to contain any author-written or third-party JavaScript. By default, the Browser agent will be included in any pages served by your application, including the pages which are intended only for consumption by the AMP webcrawler.