Thursday, April 2, 2009

processNoCache() : Disables Back Button of All Browsers

The Cache-Control header is set by processNoCache() method in
RequestProcessor as follows:

response.setHeader("Cache-Control", "no-cache");

With IE everything is fine. Hitting the back button works wonderfully and if
the
previous request was a GET it would be "re GOTTEN" and if it was a
POST, it
displays the "POST data has expired warning. U wanna resubmit?"
dialog.


However, for some other browsers, it doesn't quite work.

In Galeon and mozilla, regardless of whether the HTTP request was a POST
or a
GET, hitting the back button shows the previous screen in its original
glory
(not good).

I made a slight tweak and over-rode the processNoCache() method in
"my
RequestProcessor" (which incidentally overrides TilesRP). Inside this
overriddent, I changed the Cache-Control setting to :
response.setHeader("Cache-Control", "no-cache,no-store,max-age=0");

This works fine.

No comments:

Post a Comment

Followers