Title: Javascript Error After Optimizing speed
Last modified: January 10, 2018

---

# Javascript Error After Optimizing speed

 *  Resolved [asanabria11](https://wordpress.org/support/users/asanabria11/)
 * (@asanabria11)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/javascript-error-after-optimizing-speed/)
 * Hello,
 * Your plugin works great, and never had any problems with it. until I started 
   optimizing for google page speeds. one of the suggestions from google is move
   scripts to the footer. and while this makes the page load faster, it breaks your
   plugin.
 * I found the exact place where we can fix the issue:
    Its on the file: Php/class-
   styles.php line 70 Replacing wp_add_inline_script( “{$this->plugin->assets_prefix}-
   ssba”, sprintf( ‘Main.boot( %s );’, wp_json_encode( array() ) ) );
 * With:
    wp_add_inline_script( “{$this->plugin->assets_prefix}-ssba”, sprintf( ‘
   jQuery(function(){Main.boot( %s );})’, wp_json_encode( array() ) ) ); Fixes the
   issue in my website since it now waits for the functions and javascript to be
   loaded.
 * But this is only going to work until I update your plugin again, so I was wondering
   if you could incorporate this fix or something similar in your plugin for future
   updates.
 * Sincerely,
    Alex Sanabria
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjavascript-error-after-optimizing-speed%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Simple Share](https://wordpress.org/support/users/davidoffneal/)
 * (@davidoffneal)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/javascript-error-after-optimizing-speed/#post-9852802)
 * Hi [@asanabria11](https://wordpress.org/support/users/asanabria11/),
 * This is great stuff! Thanks so much for providing feedback.
    I’ve let our developer
   know and will be looking into implementing this feature further. If you have 
   any other questions please let us know!
 *  [kattouf](https://wordpress.org/support/users/kattouf/)
 * (@kattouf)
 * [8 years ago](https://wordpress.org/support/topic/javascript-error-after-optimizing-speed/#post-10264426)
 * Hello your code has a syntax error but i can’t figure it our. Are you sure you
   pasted correctly? I want to try it.
 * thanks
 * J

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

The topic ‘Javascript Error After Optimizing speed’ is closed to new replies.

 * ![](https://ps.w.org/simple-share-buttons-adder/assets/icon-256x256.png?rev=2661516)
 * [Simple Share Buttons Adder](https://wordpress.org/plugins/simple-share-buttons-adder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-share-buttons-adder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-share-buttons-adder/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-share-buttons-adder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-share-buttons-adder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-share-buttons-adder/reviews/)

## Tags

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

 * 2 replies
 * 3 participants
 * Last reply from: [kattouf](https://wordpress.org/support/users/kattouf/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/javascript-error-after-optimizing-speed/#post-10264426)
 * Status: resolved