 
 browserSupportsPushState = window.history and window.history.pushState and window.history.replaceState
 
+rememberInitialPage = ->
+  window.history.replaceState { turbolinks: true }, "", document.location.href
+
 
 if browserSupportsPushState
+  rememberInitialPage()
+  
   window.addEventListener 'popstate', (event) ->
     if event.state?.turbolinks
       fetchReplacement document.location.href

visit = (url) ->
  if browserSupportsPushState
    reflectNewUrl url
    fetchReplacement url
  else

  xhr = new XMLHttpRequest
  xhr.open 'GET', url, true
  xhr.setRequestHeader 'Accept', 'text/html, application/xhtml+xml, application/xml'
  xhr.onload  = -> fullReplacement xhr.responseText, url
  xhr.onabort = -> console.log("Aborted turbolink fetch!")
  xhr.send()

fullReplacement = (html, url) ->
