Skip to main content

[Obsolete] Caching GET requests in IE

GET request

The main goal of GET request is to show some data to the user: page, part of the page, control or just data. GET request shouldn’t contain any data changes or any function that leads to changes in the system to be done. Based on that it’s logical to cache GET requests, until page update after another POST request is needed.

IE Caching

 

While working with with AJAX GET requests in IE it becomes obvious, that results are cached in all cases, except the situation, when development tools are opened.
E.g. when user clicks the button “To Basket”, it’s required to refresh basket summary without page reload. It’s easy to reproduce with JQuery function load:
$ (“[container selector]”). load ("[URL]");
This function will replace the content of container with results of URL GET request. and in IE it always will be the same result.

Resolving the issue


Here described two possibilities to resolve the issue:

  1. Switch off cache is most logical operation. In case of using query you can use the function.ajax with the parameter cache set to false, or switch off cache for all JQuery requests 
    $.ajaxSetup ({ cache: false });
    Otherwise add header Cache-control with value no-cache to request.


  2. Add dummy parameter to any request you don’t want to be cached. This solution looks more like hack and not like a real solution, but, unfor
    tunately, there is no parameter to switch off the cache in a single request in.load function. But it’s possible in function .ajax.
$(“[container selector]”).load("[URL]", { dummy: Math.random() });

Comments

Popular posts from this blog

[Obsolete] Azure package unpack and repack

Azure package There are a lot of possible scenarios of Azure deployment. Most of them are based on package that we can define and create with Visual Studio. If you need to change package use Visual studio to repack your project. To prepare specific web . config file, use different build configuration with transformation (web . config . release, web.config.debug etc.) Only when it's not possible to use Visual Studio to repack Azure package, then it's possible to repack it the way described below.

RetrieveMultiple Plugins MS CRM

Plugin for RetrieveMultiple message in MS Dynamics CRM RetrieveMultiple message is not the most popular message in CRM development, because not so much types of tasks are solved via plugin registered on this message. And it leads to situation, when this message is forgotten and not used.