Javascript issue
-
I am getting multiple errors in AMP version
1. Custom JavaScript is not allowed.
2. The mandatory attribute ‘src’ is missing in tag ‘img’.
3. The parent tag of tag ‘noscript enclosure for boilerplate (transformed)’ is ‘noscript’, but it can only be ‘head’.I really fed-up to dealing with these. Please help me to resolve these error. First error ” Custom JavaScript is not allowed” getting almost in all pages.
Thank you
The page I need help with: [log in to see the link]
-
@sunnydeora Sorry to hear you’ve been encountering issues trying to adopt AMP. See answers to your queries below:
Custom JavaScript is not allowed
Custom JavaScript is restricted in AMP for performance reasons. If the theme or plugins in use output any such custom JavaScript in the frond end of your site you may encounter this error.
The mandatory attribute ‘src’ is missing in tag ‘img’
Are you using an image or lazy loading plugin? One of your plugins seems to have a no JavaScript image fallback, which is not AMP compatible. This is appearing in your Reader mode AMP URLs, causing the src validation error.
This third validation error you referenced is most likely caused by the above.
While the plugin usually handles these errors in
reader
mode if you can share your Site Health information we can troubleshoot further.Hi James,
Thank you for reply!
James, I have deactivate/activate all the plugin one by one but still issue is same.
I am not using lazy loader from long time.Here is site health info
`
### wp-core ###version: 5.4.1
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%postname%/
https_status: true
user_registration: 0
default_comment_status: open
multisite: false
user_count: 4
dotorg_communication: true### wp-paths-sizes ###
wordpress_path: /nas/content/live/renewededge
wordpress_size: 70.66 MB (74092906 bytes)
uploads_path: /nas/content/live/renewededge/wp-content/uploads
uploads_size: 658.69 MB (690685645 bytes)
themes_path: /nas/content/live/renewededge/wp-content/themes
themes_size: 55.31 MB (57994505 bytes)
plugins_path: /nas/content/live/renewededge/wp-content/plugins
plugins_size: 73.15 MB (76701715 bytes)
database_size: 17.14 MB (17973248 bytes)
total_size: 874.95 MB (917448019 bytes)### wp-dropins (2) ###
advanced-cache.php: true
object-cache.php: true### wp-active-theme ###
name: TheGem Child (thegem-child)
version: undefined
author: Anonymous
author_website: (undefined)
parent_theme: TheGem (thegem)
theme_features: automatic-feed-links, post-thumbnails, woocommerce, title-tag, menus, html5, post-formats, featured-content, editor-styles, editor-style, widgets
theme_path: /nas/content/live/renewededge/wp-content/themes/thegem-child### wp-parent-theme ###
name: TheGem (thegem)
version: 4.3.0 (latest version: 4.4.0)
author: Codex Themes.
author_website: (undefined)
theme_path: /nas/content/live/renewededge/wp-content/themes/thegem### wp-mu-plugins (4) ###
Force Strong Passwords – WPE Edition: version: 1.6.4, author: Jason Cosper
WP Engine Seamless Login Plugin: version: 1.5.4, author: WP Engine
WP Engine Security Auditor: version: 1.0.8, author: wpengine
WP Engine System: version: 4.0.0, author: WP Engine### wp-plugins-active (18) ###
AMP: version: 1.5.3, author: AMP Project Contributors
Autoptimize: version: 2.7.1, author: Frank Goossens (futtta)
Contact Form 7: version: 5.1.8, author: Takayuki Miyoshi
Contact Form 7 Extension For Mailchimp: version: 0.5.18, author: Renzo Johnson
Duplicate Post: version: 3.2.4, author: Enrico Battocchi
Enable Gzip Compression: version: 1.0.3, author: Moki-Moki Ios
File Manager Advanced: version: 3.4, author: modalweb
Head, Footer and Post Injections: version: 3.1.6, author: Stefano Lissa
Leverage Browser Caching: version: 1.9, author: Rinku Yadav
Redirection for Contact Form 7: version: 1.3.5, author: Query Solutions
Smush: version: 3.6.3, author: WPMU DEV
Testimonials Slider and Showcase: version: 1.2.5, author: RadiusTheme
TheGem Theme Elements: version: 4.3.0, author: Codex Themes (latest version: 4.4.0)
Wonder Carousel Pro: version: 17.1C, author: Magic Hills Pty Ltd
WPBakery Page Builder: version: 6.0.5, author: Michael M – WPBakery.com (latest version: 6.2.0)
WP File Manager: version: 6.2, author: mndpsingh287
Yoast SEO Premium: version: 14.1, author: Team Yoast
ZillaLikes: version: 1.1.1, author: ThemeZilla### wp-plugins-inactive (5) ###
Akismet Anti-Spam: version: 4.1.5, author: Automattic
Invisible reCaptcha: version: 1.2.3, author: Mihai Chelaru
ReCaptcha v2 for Contact Form 7: version: 1.2.6, author: IQComputing
WPForms: version: 1.5.5.2, author: WPForms
WPForms MailChimp: version: 1.4.0, author: WPForms### wp-media ###
image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1687
imagemagick_version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 https://www.imagemagick.org
imagick_limits:
imagick::RESOURCETYPE_AREA: 38 MB
imagick::RESOURCETYPE_DISK: 1073741824
imagick::RESOURCETYPE_FILE: 6144
imagick::RESOURCETYPE_MAP: 512 MB
imagick::RESOURCETYPE_MEMORY: 256 MB
imagick::RESOURCETYPE_THREAD: 1
gd_version: 2.2.5
ghostscript_version: unknown### wp-server ###
server_architecture: Linux 4.15.0-1040-gcp x86_64
httpd_software: Apache
php_version: 7.3.17-1+ubuntu18.04.1+deb.sury.org+1 64bit
php_sapi: apache2handler
max_input_variables: 10000
time_limit: 3600
memory_limit: 512M
max_input_time: 3600
upload_max_size: 50M
php_post_max_size: 100M
curl_version: 7.58.0 OpenSSL/1.1.1g
suhosin: false
imagick_availability: true
htaccess_extra_rules: true### wp-database ###
extension: mysqli
server_version: 5.7.29-32-log
client_version: mysqlnd 5.0.12-dev – 20150407 – $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $### wp-constants ###
WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /nas/content/live/renewededge/wp-content
WP_PLUGIN_DIR: /nas/content/live/renewededge/wp-content/plugins
WP_MAX_MEMORY_LIMIT: 512M
WP_DEBUG: false
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: true
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_LOCAL_DEV: undefined
DB_CHARSET: utf8
DB_COLLATE: utf8_unicode_ci### wp-filesystem ###
wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
mu-plugins: writable### amp_wp ###
amp_mode_enabled: reader
amp_templates_enabled: post, page
amp_serve_all_templates: This option does not apply to Reader mode.
amp_css_transient_caching_disabled: n/a
amp_css_transient_caching_threshold: 5000 transients per day
amp_css_transient_caching_sampling_range: 14 days
amp_css_transient_caching_transient_count: undefined
amp_css_transient_caching_time_series:Please check
Thank you@sunnydeora It looks like your theme features various functions which don’t work in AMP by default, including applying a
data-tgpli-src
in place of src attributes. You’ll notice the same attributes when checking the site demo.If you’re able to determine the handle used by your theme you can deactivate resources from running using the below:
add_action( 'wp_enqueue_scripts', function() { if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { wp_dequeue_script( 'name-of-handle' ); } }, 9999 );
You can also keep watch of the below GitHub issue in relation to being able to select a different theme for your AMP URLs, which would be suitable in your case or when using a theme not confirmed as fully compatible.
https://github.com/ampproject/amp-wp/issues/4560Hey James,
I have putted the same script in my functions.php file but issue is the still same. Can you help me on this how I can handle this issue.
Thank you
@sunnydeora Did you replace the name-of-handle with the handle names used by your themes? You’ll need to determine the handles used, it’s not something we can assist with unfortunately.
Did you check for the same issue with another theme temporarily activated?
@sunnydeora As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you encounter any further issues.
- The topic ‘Javascript issue’ is closed to new replies.