diff --git a/js/civicrmStripeConfirm.js b/js/civicrmStripeConfirm.js
index 0705463d2eed58174baca201b206e0eb9ae23966..c52920253aea939000bfe70bc6ccdfb016312605 100644
--- a/js/civicrmStripeConfirm.js
+++ b/js/civicrmStripeConfirm.js
@@ -171,10 +171,11 @@
       return;
   }
 
-  confirm.checkAndLoad();
-  confirm.handleCardConfirm();
+  document.addEventListener('DOMContentLoaded', function() {
+    CRM.payment.debugging(confirm.scriptName, 'DOMContentLoaded');
 
-  // Disable the browser "Leave Page Alert" which is triggered because we mess with the form submit function.
-  window.onbeforeunload = null;
+    confirm.checkAndLoad();
+    confirm.handleCardConfirm();
+  });
 
 }(CRM.$, CRM.ts('com.drastikbydesign.stripe')));