Home > Uncategorized > IE caching Ajax calls

IE caching Ajax calls

If you have been trying to make a REST call from your javascript or jsp page, you might have found that in firefox(FF) and Safari there is a call made to server every time . But this does not happen in IE.

This is the scenario I had

I had script file client.js which was making a rest call to get some data.

First time I could see the results but then with every other subsequent call, there was no change in state, although the data should have changed.

Now this can be fixed by multiple ways

Option 1:

Change the browser settings. To  do this you have to go to

General–Settings>

and change the settings from Automatically to Every Visit to page

This will resolve the issue.

Option 2:

Change from GET to POST

Option 3 :

Add a timestamp at end of url which will looking at which server will think it is a new URL.

I am planning to find some better solution but did not had any luck so far. Once I find anything, will update the post.

Update : Here is the solution using Servlet Filter  Servlet Filter to prevent No Cache

Categories: Uncategorized Tags: