I'm confused how AMP supports author written javascript. I learned from the doc that AMP disable author written javascript, but why does it work when I directly insert javascript code in tag? simple as the code below works fine on AMP page. Other code like I'm inserting a snippet of javascript code in tag to load a service works fine too. Thanks.

​<script>
   alert("hi");
</script>

1 Answers

0
jess On Best Solutions

This means that you are only permitted to use the JavaScript library that AMP provides – since you’re not in control, you may experience lazy loading. This might be the only downside to AMP. Therefore, you can't use custom JS. It has this open proposed design for this issue. You can also probably check AMP HTML Specification for more details about the supported tags.