AMP specific

script (javascript)

Easily create an amp-script.

amp-script allows running custom JavaScript to render UI. To execute this sandboxed javascript a meta tag needs to be added to the page with a “script hash”.

aQuery script wraps an element with amp-script and generates the script hash every time the script is changed.

  • javascript
    • Type: String
    • Custom JavaScript code

Limitations in AMP:

  1. Amp-script runs as a virtual dom which is sandboxed and very limited. Read the amp-script documentation and the supported API.

Example:

$('#container').script(console.log(document.body)); //outputs #container element