Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Set Accept-Encoding header to fetch compressed data #46

Closed
wants to merge 1 commit into from

2 participants

@igrigorik

HTML compresses well, don't waste the users bandwidth!

@igrigorik igrigorik Set Accept-Encoding header to fetch compressed data
HTML compresses well, don't waste the users bandwidth!
ac7b598
@davydotcom

Check that, this patch does not work. Chrome throws error unsafe header "Accept-Encoding"...XHR Does not allow this header to be set... :(

@igrigorik

facepalm .. right, the browser adds it automagically.

@igrigorik igrigorik closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 29, 2012
  1. @igrigorik

    Set Accept-Encoding header to fetch compressed data

    igrigorik authored
    HTML compresses well, don't waste the users bandwidth!
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  lib/assets/javascripts/turbolinks.js.coffee
View
1  lib/assets/javascripts/turbolinks.js.coffee
@@ -17,6 +17,7 @@ fetchReplacement = (url) ->
xhr = new XMLHttpRequest
xhr.open 'GET', url, true
xhr.setRequestHeader 'Accept', 'text/html, application/xhtml+xml, application/xml'
+ xhr.setRequestHeader 'Accept-Encoding', 'gzip, deflate'
xhr.onload = ->
changePage extractTitleAndBody(xhr.responseText)...
triggerEvent 'page:load'
Something went wrong with that request. Please try again.