• Resolved riaoss

    (@riaoss)


    I’m getting a lot of errors ever since I installed an AMP plugin a few days ago. Till now, I have 25 AMP errors according to Google Search Console. Most of them have this title: Disallowed attribute in HTML tag ‘amphtml engine v0.js script’

    I opened one link and a highlighted code shows up:
    <script type='text/javascript' src='https://cdn.ampproject.org/v0.js' defer onload='' async></script>
    This is only from one link. The rest are the same case. What is the problem and how can I fix it?

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    You have some optimizer plugin that is injecting defer onload='' into the script tags. Deactivate that plugin, or find a way to disable it on AMP responses.

    Thread Starter riaoss

    (@riaoss)

    Autoptimize, Smush, WP Fastest Cache, and All-in-One SEO. Which one of these could be the source of the issue?

    Plugin Author Weston Ruter

    (@westonruter)

    Probably Autoptimize. Note after deactivating you’ll probably need to flush your page cache from WP Fastest Cache to see the change.

    Probably Autoptimize.

    nope, AO is never active on AMP pages and does never add that defer onload='' string ??

    frank

    Autoptimize was the culprit. Had the same error on my site.

    Go to settings of autoptimize and add v0.js to the excluded js list. Clear all caches etc.

    And @optimizingmatters, a better approach is to ask the user about their installation details and exact issue, instead of going into denial mode imho.

    • This reply was modified 6 years, 3 months ago by nabtron.

    @nabtron there simply is no universe in which AO adds defer onload='' to a javascript tag. Moreover AO explicitly looks for <html amp or <html ? and just bails out if found.

    You can see this for yourself by looking at the HTML source of the page linked in the original post; the JS or CSS is not optimized, and if you load the page with ?ao_noptimize=1 to explicitly disable AO for that request you get the same additions to the amp script tag. even more interesting; when going to the non-AMP version of the same page and disabling AO on that you’ll see the HTML source is littered with defer onload=''.

    So my gut feeling; some other plugin is doing things when AO is detected and/ or taking AO’s exclusion list into account to add defer onload='' to script tags.

    I’d be happy to help you dig deeper into this, my curiosity-muscle is tickled ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Disallowed attribute in HTML tag ‘amphtml engine v0.js script’’ is closed to new replies.