Skip to content

sandinmyjoints/turbolinks-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

turbolinks-location

Adds Turbolinks-Location header to responses so Turbolinks can update the browser URL correctly. See https://github.com/turbolinks/turbolinks#following-redirects.

Installation

$ npm install --save turbolinks-location

API

var turbolinksLocation = require('turbolinks-location')

app.use(turbolinksLocation(options))

Options

onlyWhenHeader

When true, only send Turbolinks-Location header when the incoming request has a header indicating it is a Turbolinks request. Default: false (meaning Turbolinks-Location is sent on every response).

Here's how to set such a header:

document.addEventListener("turbolinks:request-start", function(event) {
  var xhr = event.data.xhr
  xhr.setRequestHeader("x-turbolinks-request", "true")
})

See also https://github.com/turbolinks/turbolinks#setting-custom-http-headers.

header

The name of the request header to look for. Default: x-turbolinks-request.

About

Add Turbolinks-Location header to responses.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published