 requestMethodIsSafe =
   requestMethod in ['GET','']
 
-initializeTurbolinks() if browserSupportsPushState and browserIsntBuggy and requestMethodIsSafe
+if browserSupportsPushState and browserIsntBuggy and requestMethodIsSafe
+  visit = (url) ->
+    referer = document.location.href
+    cacheCurrentPage()
+    fetchReplacement url
+
+  initializeTurbolinks()
+else
+  visit = (url) ->
+    document.location.href = url
 
 # Call Turbolinks.visit(url) from client code
 @Turbolinks = { visit }

initialized    = false
currentState   = null
referer        = document.location.href
loadedAssets   = null
pageCache      = {}
createDocument = null
requestMethod  = document.cookie.match(/request_method=(\w+)/)?[1].toUpperCase() or ''
xhr            = null

visit = (url) ->
  if browserSupportsPushState && browserIsntBuggy
    cacheCurrentPage()
    reflectNewUrl url
    fetchReplacement url
  else
    document.location.href = url


fetchReplacement = (url) ->
  triggerEvent 'page:fetch'

  event.initEvent name, true, true
  document.dispatchEvent event

processResponse = ->
  clientOrServerError = ->
    400 <= xhr.status < 600

  validContent = ->
    xhr.getResponseHeader('Content-Type').match /^(?:text\/html|application\/xhtml\+xml|application\/xml)(?:;|$)/

  extractTrackAssets = (doc) ->
    (node.src || node.href) for node in doc.head.childNodes when node.getAttribute?('data-turbolinks-track')?
