diff --git a/javascript/olm_pre.js b/javascript/olm_pre.js
index 611488b6d7d453cfb516dd7c01c1dcfab9aca1c6..ae7aba511c0a0957caab58f44dacbd508f4e203c 100644
--- a/javascript/olm_pre.js
+++ b/javascript/olm_pre.js
@@ -21,5 +21,13 @@ if (typeof(window) !== 'undefined') {
 }
 
 (function() {
-    var module; // Shadow the Node 'module' object so that emscripten won't try
-                // to fiddle with it.
+    /* applications should define OLM_OPTIONS in the environment to override
+     * emscripten module settings */
+    var Module = {};
+    if (typeof(OLM_OPTIONS) !== 'undefined') {
+        for (var key in OLM_OPTIONS) {
+            if (OLM_OPTIONS.hasOwnProperty(key)) {
+                Module[key] = OLM_OPTIONS[key];
+            }
+        }
+    }