Title: Loading javascript twice
Last modified: August 31, 2016

---

# Loading javascript twice

 *  Resolved [bruce2me](https://wordpress.org/support/users/bruce2me/)
 * (@bruce2me)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/loading-javascript-twice/)
 * I find that insert pages causes the window to load twice. That is, if I add the
   Javascript function below:
 *     ```
       window.onload = function() {
            console.log("window loaded");
       };
       ```
   
 * I see it twice if the Insert Pages plugin is activated, but only once if I deactivate
   Insert Pages. Doesn’t seem to matter how many pages I am inserting, or which 
   ones.
 * [https://wordpress.org/plugins/insert-pages/](https://wordpress.org/plugins/insert-pages/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/loading-javascript-twice/#post-7256511)
 * Interesting. I’ll try to figure out why it’s doing that. Thanks for the report!
 *  Plugin Author [Paul Ryan](https://wordpress.org/support/users/figureone/)
 * (@figureone)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/loading-javascript-twice/#post-7256635)
 * I can’t reproduce, it only fires once for me. Maybe you have an iframe also loading
   your onload event and firing off the console.log()?
 *  Thread Starter [bruce2me](https://wordpress.org/support/users/bruce2me/)
 * (@bruce2me)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/loading-javascript-twice/#post-7256638)
 * Hi Paul —
 * So sorry it actually took me until yesterday to narrow the problem down to a 
   modal window in the Foundation 6 WordPress theme I’m using. Nothing to do with
   you — except that I was inserting the html into the footer with your plugin. 
   Arrgh.
 * Thanks for looking into it — hope I didn’t waste too much of your time.
 * B.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Loading javascript twice’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/insert-pages.svg)
 * [Insert Pages](https://wordpress.org/plugins/insert-pages/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-pages/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-pages/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-pages/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-pages/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-pages/reviews/)

## Tags

 * [insert Page](https://wordpress.org/support/topic-tag/insert-page/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 3 replies
 * 2 participants
 * Last reply from: [bruce2me](https://wordpress.org/support/users/bruce2me/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/loading-javascript-twice/#post-7256638)
 * Status: resolved