Results 1 to 3 of 3

Thread: AjaxEventDecoration Caching on *ahem* IE

  1. #1

    Default 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. #2

    Default 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.....

  3. #3
    Join Date
    Jul 2010
    Posts
    4

    Default

    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?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •