Hi all,
I have noticed that when using Spring-JS and specifically decorating <a> tags with the Spring.AjaxEventDecoration that Internet Explorer will cache the results of the GET request. Safari, Firefox et al all handle Ajax requests differently and thus don't cache the results.
There are quite a few discussions on how to prevent this. One option is to append a *random* parameter to the request such as the current time so that Internet explorer fetches content each time.
I have gone about implementing this like so:
The function simply appends a time based cacheDateParameter on to the end of the href for the given <a> tag.Code:var userLinkElement = dojo.byId("accountUserLink"); var href=dojo.attr(userLinkElement, "href"); dojo.connect(userLinkElement, "onclick", null, appendCache); function appendCache() { dojo.attr(userLinkElement, "href", href+"?cacheDate="+new Date().getTime()); } Spring.addDecoration(new Spring.AjaxEventDecoration({ elementId : "accountUserLink", event : "onclick", popup: true }));
However this is far from an ideal solution. After reading the Dojo documentation:
http://docs.dojocampus.org/dojo/xhrGet
It seems to can specify a preventCache parameter to stop the caching issue.
Is there anyway to specify this parameter when using Spring.AjaxEventDecoration?
Many thanks all,
Eggsy


Reply With Quote
