• Resolved asianstars

    (@asianstars)


    when I enable Lazy Loading with W3 Total Cache:
    Google search console shows these errors for AMP:

    1. Custom JavaScript is not allowed.
    2. Only amp-boilerplate and amp-custom ‘style’ tags are allowed, and only in the document head.
    3. Disallowed attribute or attribute value present in HTML tag.

    for example this page on my site: page with amp error

    i changed Script Embed method to sync (to head) but this problem was not solved.

    please guide me
    Thank you for your effort

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @asianstars

    Thank you for reaching out and I am happy to assist you with this.
    Can you please confirm if you enabled and configured the AMP extension in W3TC Performance>Extensions?
    Thanks!

    Thread Starter asianstars

    (@asianstars)

    Thank you very much for your helpful solution.
    I enabled it. (AMP Adds compatibility for accelerated mobile pages (AMP) to minify.)
    My site errors in Google Search Console was: 288 ,now (after anable AMP): 3
    But it still has three errors.

    Disallowed attribute or attribute value present in HTML tag.
    Only amp-boilerplate and amp-custom ‘style’ tags are allowed, and only in the document head.
    Custom JavaScript is not allowed.

    <script>window.w3tc_lazyload=1,window.lazyLoadOptions={elements_selector:".lazy",callback_loaded:function(t){var e;try{e=new CustomEvent("w3tc_lazyload_loaded",{detail:{e:t}})}catch(a){(e=document.createEvent("CustomEvent")).initCustomEvent("w3tc_lazyload_loaded",!1,!1,{e:t})}window.dispatchEvent(e)}}</script><script async src="https://tradebox.ir/wp-content/plugins/w3-total-cache/pub/js/lazyload.min.js"></script></body></html>
    

    For Example In This Page

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @asianstars

    Thank you for your feedback.
    I’ve tested the AMP and the AMP version is valid. I’ve tested both code and the URL

    So as I can see, the AMP version is valid and there are no issues as the Lazyload is also AMP-compatible:
    Lazy Loading (AMP endpoint)

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom JavaScript is not allowed’ is closed to new replies.