Can I prevent ‘optimization’ plugins from deferring my plugin’s javascript?

[ad_1]

The plugin I manage enqueues a JS in the <head> that allows our iframe to communicate with the parent page via URL parameters. If the JS doesn’t run at page load, the iframe ends up blank. I’m finding that some optimization plugins (WP Rocket, etc.) add a “defer” attribute to my script that breaks our functionality.

Is there anything I can do from within my plugin to prevent other plugins from deferring my JS or do I just have to tell users “be sure to exclude this page from any JS deferrals” on a case-by-case?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer