: For chartjs versus AMP On my WordPress blog in default mode I have a <canvas> where I draw a chart with ChartJS. I've just downloaded the AMP plugin, run the Google AMP Test tool,
On my WordPress blog in default mode I have a <canvas> where I draw a chart with ChartJS. I've just downloaded the AMP plugin, run the Google AMP Test tool, and it says:
Fix the following issue
Prohibited or invalid use of HTML Tag
The tag 'canvas' is disallowed.
How do you go about fixing this? Is there any way to do JavaScript with AMP?
More posts by @Goswami781
1 Comments
Sorted by latest first Latest Oldest Best
You can't run your own JavaScript when using AMP, that defeats the purpose of AMP. Instead, you can iframe your external content using the amp-iframe element.
Add the amp-iframe JS to the head.
<script async custom-element="amp-iframe"
src="https://cdn.ampproject.org/v0/amp-iframe-0.1.js"></script>
Add the amp-iframe element where you want your iframe to go.
<amp-iframe width="200" height="100"
sandbox="allow-scripts allow-same-origin" layout="responsive"
src="https://example.com/"></amp-iframe>
A full guide to using amp-iframe is available at:
www.ampproject.org/docs/guides/iframes
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.