Title: Prevent Javascript issues by modifying the plugin init js
Last modified: January 6, 2020

---

# Prevent Javascript issues by modifying the plugin init js

 *  Resolved [jkeasley2](https://wordpress.org/support/users/jkeasley2/)
 * (@jkeasley2)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/prevent-javascript-issues-by-modifying-the-plugin-init-js/)
 * Could you use
 *     ```
       window.addEventListener("load", function () {
       	cookieNotice.init();
       }, false);
       ```
   
 * rather than window.onload to initialise this plugin, as if anything at all is
   attached to the window.onload event then the last loaded code attached to the
   event will be the *only* code which is run, which will break things.
 * the above syntax will be much safer

Viewing 1 replies (of 1 total)

 *  Plugin Author [dFactory](https://wordpress.org/support/users/dfactory/)
 * (@dfactory)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/prevent-javascript-issues-by-modifying-the-plugin-init-js/#post-12525847)
 * Thx.
    We’ve adopted that.

Viewing 1 replies (of 1 total)

The topic ‘Prevent Javascript issues by modifying the plugin init js’ is closed 
to new replies.

 * ![](https://ps.w.org/cookie-notice/assets/icon-256x256.png?rev=3549327)
 * [Compliance by Hu-manity.co](https://wordpress.org/plugins/cookie-notice/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-notice/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-notice/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-notice/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-notice/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-notice/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [dFactory](https://wordpress.org/support/users/dfactory/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/prevent-javascript-issues-by-modifying-the-plugin-init-js/#post-12525847)
 * Status: resolved