Ajax: decide on and add a "cache buster" option
-
Kit Goncharov
- State changed from new to open
Sounds good. I'd think just appending a unique ID to the end of the request would work, i.e.:
key=value&key2=value2&_=1.I don't think the ID really has to be randomized — we could probably just declare
var uniqueID = 1in a closure, and then increment it every time an Ajax request is instantiated. jQuery uses+new Date()to create a unique ID — is there any benefit to using this over a basic incrementation?I'm not really sure if we need an option for this, though...
-
Kit Goncharov
- Tag changed from ajax to ajax, discuss
-
John-David Dalton
I agree and I like the idea. I also saw jQuery messing with expire headers as well.
I am for an Id based on time and an increment because if the user refreshes the page and we just used an increment they would get cached data.We could have a based on time and if a new id matches an old id
(say multiple ajax calls at once), then we increment them so they don't match the last id. -
John-David Dalton
Loads of info here https://developer.mozilla.org/En/Using_XMLHttpRequest
important to this ticket is a section called "Bypassing the cache".
-
Mark Caudill
The only problem with loadFlags is that there is no way to test without doing a browser sniff. John seems he wants to avoid browser sniffs, so the ultimate solution may be what jQuery is doing (and Firefox recommends doing for cross-browser compatible in the link JDD gave). They just use the _ variable and replace the _ variable if it is already present. I think _ is too simple of a variable to take over, but that's just my opinion on that one.
-
John-David Dalton
We shouldn't use the
_underscore param because it causes issues with some environments.#9273 (Oracle App. Sever chokes on Ajax underscore parameter (Safari)) - Rails Trac - Trac
Fuse actually removed the one that Prototype appends to its
POSTrequests.
The CHANGELOG entry explains it rather well.* Remove the "&_=" Safari 2 ajax bug workaround for the http PUT method. [Rails Trac #2258] [Prototype LH #327] [jddalton, Mark van Eijk, Shane Vitarana] Fixed in Rails by changeset http://dev.rubyonrails.org/changeset/2106. -
Joe Gornick
- Milestone cleared.
- Milestone order changed from 0 to 0
-
Joe Gornick
- State changed from open to new
- Assigned user changed from Mark Caudill to John-David Dalton
-
Joe Gornick
- State changed from new to discuss
- Tag changed from ajax, discuss to ajax
- Milestone order changed from 3 to 0
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.