1

I am using spring MVC for angular JS for front end, when I login to my application with the first user credentials I am able to view the correct details.

When I login with the next user again I am seeing the details of the first user. This happens only in IE. I need to clear the cookies manually to see the right details before i login with different usernames.

I browsed and added some code in HTML but it didnt work out.

<meta http-equiv='cache-control' content='no-cache'/>
<meta http-equiv='expires' content='-1'/>

But, there is no change when I used the above code also.

Karthik
  • 470
  • 7
  • 20

1 Answers1

2

You can force Internet Explorer not to cache your page using the following headers:

Expires: -1
Cache-Control: private, max-age=0

See Making sure a web page is not cached, across all browsers

Community
  • 1
  • 1
  • Should we need to add in servlet code as mentioned in the example – Karthik Apr 12 '15 at 14:14
  • Do you really need expires too? – Neil McGuigan Apr 12 '15 at 17:07
  • `@RequestMapping(value = "/setup", method = RequestMethod.GET) public @ResponseBody String setupGroupDetails(@RequestParam String name, HttpServletResponse response) { response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1. response.setHeader("Pragma", "no-cache"); // HTTP 1.0. response.setDateHeader("Expires", -1);` } I used the above code in controller method but still the page is getting cached @sami – Karthik Apr 13 '15 at 04:16
  • I used a random string to my url for the pages those are getting cached and I solved the issued – Karthik Apr 14 '15 at 07:06