08-10-2007 12:40 AM - edited 03-13-2019 04:21 PM
I've been developing a series of services for use on the 7940 and 7970 phones, but when began compatibility testing for the 7970's, i noticed that it caches the content of previous xml pages visited.
Some parts of the services i've created rely on pages always being re-freshed when they are returned to by pressing the exit soft key. Is there any way to enforce a page-refresh on the 7970's?
I'd thought there might be a recognized header-tag to enable this, though using page expiries is clearly out of the question.
Any help would be greatly appreciated.
08-10-2007 07:44 AM
On the page, that is supposed to expire, add a date header like in this Java code:
response.setDateHeader("Expires",-1);
Cheers, and don't forget to rate this post :)
08-12-2007 07:07 PM
I understand how to use page expiries to remove elements from the URL stack, but i'm looking to have an item which will be returned to, but will refresh itself upon return. (This happens on the 7940's automatically, because they have no page caching ability, but the 7970's have a cache, and won't automatically re-load previous pages.)
An example of the header to do this in HTML terms would normally be Pragma = "no-cache" or Cache Control = "no-cache". I'm wondering if they'res a phone-recognised equivalent header. or some other solution. (Neither of the above headers seem to be recognised by the phone.)
08-13-2007 12:57 AM
Unfortunately, "response.setDateHeader("Expires",-1); " isn't going to cut it in Java.. it's code that works on IIS. The above would return in an expiration header that is 1 minute before "right now", whereas in Java, the return value is "-1", and you'd like "right now minus 1 minute" instead. I have not found any other way but to construct the time string manually, e.g. like this:
public static String getServerTimeString()
{
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
cal.add(Calendar.MINUTE, -1);
SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss", new Locale("en", "US"));
String datetime = sdf.format(cal.getTime());
datetime += " GMT";
return datetime;
}
Since this code is timezone dependant, you might just want to subtract more than a minute (e.g. in my case I'm in timezone GMT+1 so with the summer time, if I subtract 2 hours I'm always on the safe side)
08-13-2007 05:13 AM
I use the trick of appending the URL with a dummy random number to "trick" the phone into thinking that it is a new page, i.e:
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide