diff --git a/dist/oauth2-redirect.html b/dist/oauth2-redirect.html
index 64b171f7..b662eed4 100644
--- a/dist/oauth2-redirect.html
+++ b/dist/oauth2-redirect.html
@@ -67,9 +67,13 @@
window.close();
}
- window.addEventListener('DOMContentLoaded', function () {
- run();
- });
+ if (document.readyState !== 'loading') {
+ run();
+ } else {
+ document.addEventListener('DOMContentLoaded', function () {
+ run();
+ });
+ }