0

I am Implementing AMP in my side but i am gating Error:

The tag 'script' is disallowed except in specific forms. please tell me to remove this Error.

Adithya Sai
  • 1,592
  • 2
  • 19
  • 33
princespn
  • 31
  • 7

2 Answers2

0

The best way is using the scripts outside the AMP in amp-iframe

first

Add amp-iframe helper inside head

  <script async custom-element="amp-iframe" src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>

second

make an iframe call using https://ampbyexample.com/components/amp-iframe/ be sure to sandbox="allow-scripts allow-same-origin"

you will note that it won't work if you are calling the iframe from the same origin so you should use another origin

for example if your domain example.com use

<amp-iframe width="500"
      height="281"
      layout="responsive"
      sandbox="allow-scripts allow-same-origin"
      allowfullscreen
      frameborder="0"
      src="https://iframe.example.com/script">

  </amp-iframe>

Note

not all the features will work as expected without JavaScript inside the webpage however I admit that amp-html make the websites faster

Alsemany
  • 445
  • 1
  • 5
  • 13
0

Script is not allowed in amp document. Better use the amp components if they match your requirements. You can find the details of amp components here: https://www.ampproject.org/docs/reference/components

Adithya Sai
  • 1,592
  • 2
  • 19
  • 33