Properly load JS on page load
diff --git a/templates/article.html b/templates/article.html
index 017a933..c6a8582 100644
--- a/templates/article.html
+++ b/templates/article.html
@@ -60,7 +60,7 @@
   {% if FUZZY_DATES %}
   {% block scripts %}
   {{ super() }}
-  <script type="text/javascript">lw_timeago.doReplace()</script>
+  <script type="text/javascript">window.addEventListener('load', function(){lw_timeago.doReplace()})</script>
   {% endblock %}
   {% endif %}
 
diff --git a/templates/base.html b/templates/base.html
index ee0bd97..3b0bc7e 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -161,15 +161,16 @@
   {% block scripts %}
   {% if SCROLL_TO_CONTENT %}
   <script type="text/javascript">
+    window.addEventListener('load', function(){
     if (window.location.pathname != '/' && window.location.pathname != '/index.html'){
       window.scroll(0, document.getElementById('main').offsetTop);
-    }
+    }})
   </script>
   {% endif %}
 
   {% if MANGLE_EMAILS %}
   <script type="text/javascript">
-    window.onload = function(){
+    window.addEventListener('load', function(){
       var e = document.querySelectorAll(".email");
       for (var i = 0; i < e.length; i++) {
         var email = e[i].getAttribute("data-email")
@@ -180,7 +181,7 @@
           e[i].removeAttribute("class");
         }
       }
-    };
+    })
   </script>
   {% endif %}
   {% endblock scripts %}