         #       return browser.query("meta[http-equiv='refresh']");
         #     }
         #   });
-        handleRefresh = ->
-          refresh = document.querySelector("meta[http-equiv='refresh']")
-          if refresh
-            content = refresh.getAttribute("content")
-            match   = content.match(/^\s*(\d+)(?:\s*;\s*url\s*=\s*(.*?))?\s*(?:;|$)/i)
-            if match
-              [nothing, refresh_timeout, refresh_url] = match
-            else
-              return
-            refreshTimeout = parseInt(refresh_timeout, 10)
-            refreshURL     = refresh_url || document.location.href
-            if refreshTimeout >= 0
-              window._eventQueue.enqueue ->
-                # Count a meta-refresh in the redirects count.
-                history.replace(refreshURL)
-                # This results in a new window getting loaded
-                newWindow = history.current.window
-                newWindow.addEventListener "load", ->
-                  newWindow._response.redirects++
-        ###
-        # Document parsed and such
+        refresh = document.querySelector("meta[http-equiv='refresh']")
+        if refresh
+          content = refresh.getAttribute("content")
+          match   = content.match(/^\s*(\d+)(?:\s*;\s*url\s*=\s*(.*?))?\s*(?:;|$)/i)
+          if match
+            [nothing, refresh_timeout, refresh_url] = match
+          else
+            return
+          refreshTimeout = parseInt(refresh_timeout, 10)
+          refreshURL     = refresh_url || document.location.href
+          if refreshTimeout >= 0
+            window._eventQueue.enqueue ->
+              # Count a meta-refresh in the redirects count.
+              history.replace(refreshURL)
+              console.log(refreshURL)
+              # This results in a new window getting loaded
+              newWindow = history.current.window
+              newWindow.addEventListener "load", ->
+                newWindow._response.redirects++
+            return
+
         if document.documentElement
           browser.emit("loaded", document)
         else

  window.navigator =
    appName:        "Zombie"
    cookieEnabled:  true
    javaEnabled:    false
    language:       browser.language
    mimeTypes:      emptySet
    noUI:           true

# opener    - Opening window (for window.open)
module.exports = loadDocument = (options)->
  { browser } = options
  { history } = options
  { url }     = options
  if url && browser.site
    site  = if /^(https?:|file:)/i.test(browser.site) then browser.site else "http://#{browser.site}"
