   xhr.send()
 
 fetchHistory = (url) ->
-  while(historyCache.length > 0)
-    cache = historyCache.pop()
+  while(window.historyCache.length > 0)
+    cache = window.historyCache.pop()
     if cache.url == url
       replaceHTML cache.html
       triggerPageChange

historyCache = []
visit = (url) ->
  if browserSupportsPushState?
    reflectNewUrl url

  document.documentElement.appendChild doc.body, originalBody
  document.documentElement.removeChild originalBody
  document.title = title.textContent if title = doc.querySelector "title"
  window.historyCache.push({url: document.location.href, html:html}) if cache


extractLink = (event) ->
