xonecas.io
2495
Xg

xonecas.github.com / commit 4425987

post

xonecas2013-03-05 4425987ece6ab807831c5fde4644166f210e86a6 parent 7926685

1 file changed

_posts/2013-02-28-the-back-button-the-xhr-and-the-chrome.markdown+14−0
@@ -0,0 +1,14 @@
1+---
2+layout: post
3+---
4+
5+The Back Button, the Ajax, and the Chrome
6+-----------------------------------------
7+
8+Sunnyvale, Feb 28, 2013
9+
10+Yesterday I came across a weird situation, that only happens on chrome (*shocking*!).
11+
12+At work, we have implemented `/search` as both a JSON endpoint and a HTML page. We choose what we send out depending on the `x-requested-with` header. Unfortunately doing this without any precaution, makes Chrome think that the latest response from `/search` xhr or page refresh is the latest version of `/search`. So when we try to navigate back to search, we get the JSON dump of the last executed search. This is simply resolved by adding a cache buster to the querystring, in our case that looks …
13+
14+Hope this helps someone debug the problem faster, and understand it.