Ajax: decide on and add a "cache buster" option
Reported by Mark Caudill | July 16th, 2009 @ 08:28 AM
This will work simply by making the URI more unique with a randomized number similar to jQuery and others. This will be triggered if an option is set (defaults to on) and using GET.
Comments and changes to this ticket
-
Kit Goncharov July 16th, 2009 @ 04:23 PM
- 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 = 1
in 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 July 16th, 2009 @ 09:01 PM
- Tag changed from ajax to ajax, discuss
-
John-David Dalton August 3rd, 2009 @ 11:25 AM
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 August 3rd, 2009 @ 05:25 PM
Loads of info here https://developer.mozilla.org/En/Using_XMLHttpRequest
important to this ticket is a section called "Bypassing the cache".
-
Mark Caudill August 3rd, 2009 @ 07:15 PM
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 August 3rd, 2009 @ 10:13 PM
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
POST
requests.
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 September 19th, 2010 @ 05:51 PM
- Milestone cleared.
- Milestone order changed from 0 to 0
-
Joe Gornick September 29th, 2010 @ 09:47 AM
- State changed from open to new
- Assigned user changed from Mark Caudill to John-David Dalton
-
Joe Gornick March 6th, 2011 @ 10:38 PM
- 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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
JavaScript frameworks share similar features and functionality such as DOM manipulation, event registration, and CSS selector engines. FuseJS attempts to incorporate the strengths of these frameworks into one stable, efficient, and optimized core JavaScript framework.