• i don’t know why this error is showing. when i validate amp its showing Custom JavaScript is not allowed. below is code which loading as custom javascript.

    Website Mode: Standard

    <script>document.addEventListener( "DOMContentLoaded", function() { document.write = function( text ) { throw new Error( "[AMP-WP] Prevented document.write() call with: " + text ); }; } );</script>

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

Viewing 1 replies (of 1 total)
  • @rohaan9 thanks for opening a topic. Since you’re using the plugin in Standard mode, this script is added as part of the default behavior of the plugin when it detects excessive CSS on your AMP page. When running the homepage through the AMP validator, note that your page is serving around 75kb of CSS when the AMP limit is 50kb.

    In Standard mode, the excessive CSS will be kept to prevent the styles on the page from breaking, but the plugin will remove the amp attribute and add the script you referenced to prevent the page from breaking in a particular scenario (when <amp-live-list> is present).

    The page still makes use of AMP components and all other invalid markup is removed (reference the validation pages in the plugin for more detail). You’ll get the benefits of speed that AMP provides, but since the page is invalid it won’t be eligible for prerendering in search results. To pass validation, consider reducing the amount of CSS on the page.

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