diff --git a/js/jquery.cloudinary.js b/js/jquery.cloudinary.js
index <HASH>..<HASH> 100644
--- a/js/jquery.cloudinary.js
+++ b/js/jquery.cloudinary.js
@@ -228,7 +228,7 @@
       }

     }

 

-    var prefix = window.location.protocol == 'file:' ? "file://" : (secure ? 'https://' : 'http://');

+    var prefix = secure ? 'https://' : window.location.protocol + '//';

     if (cloud_name.match(/^\//) && !secure) {    

       prefix = "/res" + cloud_name;

     } else {
Secure option overrides window.location.protocol

When the secure option is truthy, the the URL prefix will be set to
https:// regardless of what the window.location.protocol is. When the
option is falsy, the URL prefix will be the same as the
window.location.protocol.