[wp-trac] [WordPress Trac] #60147: Possible bug when YouTube embeds having both loading=lazy attribute and the enablejsapi parameter

WordPress Trac noreply at wordpress.org
Thu Feb 15 06:12:14 UTC 2024


#60147: Possible bug when YouTube embeds having both loading=lazy attribute and the
enablejsapi parameter
--------------------------+------------------------------
 Reporter:  asafm7        |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Embeds        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  performance
--------------------------+------------------------------

Comment (by zraftakx79):

 It appears that you are experiencing an issue with YouTube embeds when
 using both the `loading="lazy"` attribute and the `enablejsapi` parameter.
 This results in a console error related to postMessage failing due to a
 mismatch in the origin.

 While you've attempted to address the issue by setting the origin and
 widget_referrer parameters, it seems the problem persists. You've also
 raised the issue on the YouTube Issue Tracker multiple times, but it has
 been closed as "not reproducible."

 Given the complexity of the issue and the possibility that it may be
 related to how WordPress implements the API, here are some steps you can
 take to further investigate and potentially resolve the issue:

 1. **Reproduce the Issue**: Ensure that you can consistently reproduce the
 issue on different browsers and devices. This will help provide more
 concrete evidence when raising the issue with YouTube or WordPress.

 2. **Review WordPress Implementation**: Examine how WordPress handles
 YouTube embeds and the parameters it includes when generating the embed
 code. This may involve reviewing WordPress core code or any relevant
 plugins or themes that modify embed behavior.

 3. **Test without Lazy Loading**: Temporarily remove the `loading="lazy"`
 attribute from the YouTube embeds and see if the issue persists. This can
 help determine if lazy loading is indeed the cause of the problem.

 4. **Check for Plugin or Theme Conflicts**: Disable all plugins and switch
 to a default WordPress theme to see if the issue persists. If the problem
 goes away, gradually re-enable plugins and switch themes to identify any
 conflicts.

 5. **Reach Out to WordPress Community**: Seek assistance from the
 WordPress community through forums, support channels, or developer
 communities. Others may have encountered similar issues and can provide
 insights or workarounds.

 6. **Report to YouTube Again**: Provide detailed steps to reproduce the
 issue, including any specific configurations or parameters used in
 WordPress. Include console logs and error messages to help illustrate the
 problem.

 7. **Consider Alternative Solutions**: Explore alternative approaches to
 embedding YouTube videos, such as using a different lazy loading
 implementation or custom JavaScript solutions. This may help bypass the
 issue until a permanent fix is available.

 By following these steps and gathering more information about the issue,
 you'll be better equipped to address it effectively and potentially find a
 solution or workaround. Additionally, collaboration with the WordPress
 community and continued communication with YouTube support can help
 expedite the resolution process.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60147#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list