   constructor: (request) ->
     @progress = 0
 
-    size = null
-    request.onprogress = =>
-      try
-        headers = request.getAllResponseHeaders()
-
-        for name, val of headers
-          if name.toLowerCase() is 'content-length'
-            size = +val
-            break
-
-      catch e
-
-      if size?
-        # This is not perfect, as size is in bytes, length is in chars
+    if request.onprogress isnt undefined
+      # It will be null, not undefined, on browsers which don't support it
+      
+      size = null
+      _onprogress = request.onprogress
+      request.onprogress = =>
         try
-          @progress = request.responseText.length / size
+          headers = request.getAllResponseHeaders()
+
+          for name, val of headers
+            if name.toLowerCase() is 'content-length'
+              size = +val
+              break
+
         catch e
-      else
-        # If it's chunked encoding, we have no way of knowing the total length of the
-        # response, all we can do is incrememnt the progress with backoff such that we
-        # never hit 100% until it's done.
-        @progress = @progress + (100 - @progress) / 2
-
-    request.onload = request.onerror = request.ontimeout = request.onabort = =>
-      @progress = 100
+
+        if size?
+          # This is not perfect, as size is in bytes, length is in chars
+          try
+            @progress = request.responseText.length / size
+          catch e
+        else
+          # If it's chunked encoding, we have no way of knowing the total length of the
+          # response, all we can do is increment the progress with backoff such that we
+          # never hit 100% until it's done.
+          @progress = @progress + (100 - @progress) / 2
+
+      _onprogress?(arguments...)
+
+    _onreadystatechange = request.onreadystatechange
+    request.onreadystatechange = =>
+      if request.readyState in [0, 4]
+        @progress = 100
+      else if not request.onprogress? and request.readyState is 3
+        @progress = 50
+
+      _onreadystatechange?(arguments...)
 
 class ElementMonitor
   constructor: (selectors...) ->

bar = null
uniScaler = null
animation = null

if window.pushState?
  _pushState = window.pushState
  window.pushState = ->

go = ->
  bar.render()

  cancelAnimation = false
  animation = runAnimation (frameTime, enqueueNextFrame) ->
    # Every source gives us a progress number from 0 - 100
    # It's up to us to figure out how to turn that into a smoothly moving bar
