Support » Plugin: YouTube Playlist Player » Uncaught TypeError in console after 4.2 update

  • Resolved Elvis Morales

    (@elvismdev)



    Hi,

    I’ve just updated the plugin to v4.2, and I’m experiencing this error in the JS console on pages where the plugin is not even used, or better said, pages where the shortcode is not being called.

    ytpp-main.js?ver=4.8.1:54 Uncaught TypeError: Cannot read property 'dataset' of null
        at window.onload (ytpp-main.js?ver=4.8.1:54)
    window.onload @ ytpp-main.js?ver=4.8.1:54

    See error screenshot

    This brought me to notice that on pages where the playlist shortcode is not being used, still it loads the plugin’s ytpp-main.js and style.css file.

    It would be a good practice if those scripts are queued/added to WordPress pages via the wp_enqueue_scripts() action, only when the playlist shortcode is actually present to render a YT playlist.

    Good to mention that on pages where the shortcode is present, there are no errors and the playlist works as expected.

Viewing 1 replies (of 1 total)
  • Plugin Author Ciprian

    (@butterflymedia)

    Thank you for your report. I have disabled execution of code where the shortcode is not present. The .js file is still loaded globally, because excluding it based on shortcode presence would involve an ugly hack.

Viewing 1 replies (of 1 total)
  • The topic ‘Uncaught TypeError in console after 4.2 update’ is closed to new replies.