Announcement Announcement Module
Collapse
No announcement yet.
AjaxEventDecoration Caching on *ahem* IE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AjaxEventDecoration Caching on *ahem* IE

    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:

    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
    						}));
    The function simply appends a time based cacheDateParameter on to the end of the href for the given <a> tag.

    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

  • #2
    Further info

    It seems that after further testing the above 'workaround' isn't functioning as well as I thought it would be. In some cases the href is updated after the GET request has been made so back to the drawing board I think.....

    Comment


    • #3
      Did anyone find a solution to this problem?

      The presented workaround actually works in most cases, but adding parameters to all URL's is not preferable.

      Is it possible to set cahce to false on the "Dojo Ajax call" somehow in Spring.js or Spring-Dojo.js?

      Comment

      Working...
      X