diff --git a/javascript_libraries.module b/javascript_libraries.module
index 07e46af..61285c3 100644
--- a/javascript_libraries.module
+++ b/javascript_libraries.module
@@ -346,13 +346,44 @@ function javascript_libraries_block_view_alter(&$data, $block) {
       $library = javascript_libraries_custom_load($id);
       // Only libraries that are not otherwise loaded will be loaded for this block.
       if (!empty($library) && $library['scope'] == 'disabled') {
-        javascript_libraries_add_js($library, $options);
+        // Add a script loader inline to blocks that will be cached since
+        // drupal_add_js won't run when the cached version is served.
+        if (isset($block->cache) && $block->cache > 0) {
+          $inline = javascript_libraries_add_inline($library['uri']);
+          // Use #suffix if content is a renderable array, otherwise append the
+          // output string.
+          if (is_array($data['content'])) {
+            $data['content']['#suffix'] = $inline;
+          }
+          elseif (is_string($data['content'])) {
+            $data['content'] .= $inline;
+          }
+        }
+        else {
+          javascript_libraries_add_js($library, $options);
+        }
       }
     }
   }
 }
 
 /**
+ * Add script loader inline instead of using drupal_add_js. Used for attaching
+ * a script to markup that will be cached.
+ *
+ * @param $url
+ *   Url of the script to be loaded.
+ * @return string
+ *   Inline javascript to load the script.
+ */
+function javascript_libraries_add_inline($url) {
+  $string = '<script type="text/javascript">
+            jQuery(document).ready(function() { jQuery.getScript("' . $url . '"); });
+            </script>';
+  return $string;
+}
+
+/**
  * Implements hook_form_FORM_ID_alter().
  */
 function javascript_libraries_form_block_admin_configure_alter(&$form, &$form_state) {
