Ad

How To Solve Every AMP Errors In PHP Website Testing

Only 3 error type left from AMP test

Custom JavaScript is not allowed. (23 instances)

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> 

The attribute 'href' in tag 'link rel=stylesheet for fonts' is set to the invalid value. (10 instances)

<link rel="stylesheet" target="_blank" rel="nofollow noreferrer" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.2/jquery-confirm.min.css">
<link target="_blank" rel="nofollow noreferrer" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css" rel="stylesheet"> 
<link rel="stylesheet" target="_blank" rel="nofollow noreferrer" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />

The tag 'img' may only appear as a descendant of tag 'noscript'. Did you mean 'amp-img'? (50 instances)

For event `<img>` tag it is showing error. I have even used alt, width, height attributes properly.

I cannot solve these errors. Please someone tell me how to go through this.

Cannot open website in internet explorer also.

I am using https://search.google.com/test/amp

Ad

Answer

AMP has strict rules you have to abide by.

You can't just load js. You need to use allowed scripts and components: https://amp.dev/documentation/components/

You can't use <img> tag, you need to use <amp-img>

You can't load fonts the regular way, you need to use amp-font: https://amp.dev/documentation/components/amp-font/?format=websites

Ad
source: stackoverflow.com
Ad