Replace Vary header with explicit xhr=1 param
authorJohn Firebaugh <john.firebaugh@gmail.com>
Sat, 9 Nov 2013 01:11:54 +0000 (17:11 -0800)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Sat, 9 Nov 2013 01:11:54 +0000 (17:11 -0800)
IE10 doesn't respect the Vary header.

app/assets/javascripts/index.js
app/assets/javascripts/index/export.js
app/assets/javascripts/index/history.js
app/controllers/application_controller.rb

index f982ff1e1c34cd81f1c3b611a09231ca0451d657..5e96c35174a6f66fb106b58c7ffe6fb234689e48 100644 (file)
@@ -235,7 +235,7 @@ $(document).ready(function () {
     page.pushstate = page.popstate = function(path) {
       $("#content").addClass("overlay-sidebar");
       map.invalidateSize();
-      $('#sidebar_content').load(path, function(a, b, xhr) {
+      $('#sidebar_content').load(path + "?xhr=1", function(a, b, xhr) {
         if (xhr.getResponseHeader('X-Page-Title')) {
           document.title = xhr.getResponseHeader('X-Page-Title');
         }
@@ -254,7 +254,7 @@ $(document).ready(function () {
     var page = {};
 
     page.pushstate = page.popstate = function(path, type, id) {
-      $('#sidebar_content').load(path, function(a, b, xhr) {
+      $('#sidebar_content').load(path + "?xhr=1", function(a, b, xhr) {
         if (xhr.getResponseHeader('X-Page-Title')) {
           document.title = xhr.getResponseHeader('X-Page-Title');
         }
index 4842fff0ca4c081b154e4e79845db2ba0113c3cf..a2d6c4f0738562130f4d800a55d85b198806f4f4 100644 (file)
@@ -51,7 +51,7 @@ OSM.Export = function(map) {
 
   page.pushstate = page.popstate = function(path) {
     $("#export_tab").addClass("current");
-    $("#sidebar_content").load(path, function(a, b, xhr) {
+    $("#sidebar_content").load(path + "?xhr=1", function(a, b, xhr) {
       if (xhr.getResponseHeader('X-Page-Title')) {
         document.title = xhr.getResponseHeader('X-Page-Title');
       }
index 6cbc86307b97b4446214b9d977fdce95207c5a85..29a3d1fb90a76bc59f0472f598433971dd845db4 100644 (file)
@@ -99,7 +99,7 @@ OSM.History = function(map) {
 
   page.pushstate = page.popstate = function(path) {
     $("#history_tab").addClass("current");
-    $("#sidebar_content").load(path, function(a, b, xhr) {
+    $("#sidebar_content").load(path + "?xhr=1", function(a, b, xhr) {
       if (xhr.getResponseHeader('X-Page-Title')) {
         document.title = xhr.getResponseHeader('X-Page-Title');
       }
index 9c6ea3b33beb9009680f75a1338d6b6724760170..97ab5abfc397036304e6e3f73311f80dea2ffa84 100644 (file)
@@ -423,7 +423,6 @@ class ApplicationController < ActionController::Base
   end
 
   def map_layout
-    response.headers['Vary'] = 'X-Requested-With'
     request.xhr? ? false : 'map'
   end