diff --git a/sw.js b/sw.js
index dd9118dddea2f38fca227cd6ac99a4081057f3d4..3ab154785bc0d6dacb26397380e8f094cb88ab16 100644
--- a/sw.js
+++ b/sw.js
@@ -1,3 +1,4 @@
+'use strict';
 importScripts('vendor/localforage.min.js');
 
 var CACHE = 'calc';
@@ -21,8 +22,11 @@ const cacheFileExtList = ['.js', '.css', '.png', '.jpg', '.gif'];
  */
 const shouldCache = function (url) {
     const path = getUrlPath(url);
-    if (cachePathList.indexOf(path) !== -1) {
-    	return true;
+    for (let cachePath of cachePathList) {
+	// since sw.js is scoped at ./, this should work.
+	if (path.endsWith(cachePath)) {
+    	    return true;
+	}
     }
     return cacheFileExtList.some(function (ext, index, ar) {
     	return path.endsWith(ext);
@@ -33,7 +37,7 @@ const shouldCache = function (url) {
  */
 const isVendorAsset = function (url) {
     const path = getUrlPath(url);
-    return path.startsWith('/vendor/');
+    return path.includes('/vendor/');
 };
 /**
  * return true if this URL is static asset. see cacheFileExtList.