473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Ajax caching on pages...

Mel
I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.

Is there a way to prevent this from happenning ?

Mar 19 '07 #1
12 1371
Mel said the following on 3/19/2007 11:45 AM:
I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.

Is there a way to prevent this from happenning ?
Yes, use a unique URL by adding a timestamp to the URL.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 19 '07 #2
Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:
Mel said the following on 3/19/2007 11:45 AM:
>I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.

Is there a way to prevent this from happenning ?

Yes, use a unique URL by adding a timestamp to the URL.
if you can get to the headers, you can help it too... here is a snippet of
code from my PHP generating pages:

//IE actually caches ajax pages. Just another reason to hate that browser.
header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache")
Mar 19 '07 #3
Good Man said the following on 3/19/2007 5:03 PM:
Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:
>Mel said the following on 3/19/2007 11:45 AM:
>>I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.

Is there a way to prevent this from happenning ?
Yes, use a unique URL by adding a timestamp to the URL.

if you can get to the headers, you can help it too... here is a snippet of
code from my PHP generating pages:

//IE actually caches ajax pages. Just another reason to hate that browser.
Hate a browser because it doesn't act the way you want it to instead of
learning how to code it. Intuitive.
header("Expires: Sun, 19 Nov 1978 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache")
There is still no guarantee even setting the headers. Adding a timestamp
to the URL is proven to be reliable.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 19 '07 #4
On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
Good Man said the following on 3/19/2007 5:03 PM:
>Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:
>>Mel said the following on 3/19/2007 11:45 AM:
I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.

Is there a way to prevent this from happenning ?
Yes, use a unique URL by adding a timestamp to the URL.

if you can get to the headers, you can help it too... here is a snippet
of code from my PHP generating pages:

//IE actually caches ajax pages. Just another reason to hate that
browser.

Hate a browser because it doesn't act the way you want it to instead of
learning how to code it. Intuitive.
It's pretty easy to hate a browser that continually shifts its
"standards", I've seen many websites that render fine in IE6 that don't
render properly in IE7.

The function of a browser is write once display anywhere... so this is
clearly a failure on MS's part not in the programmers.
Mar 19 '07 #5
Ivan Marsh said the following on 3/19/2007 6:11 PM:
On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>Good Man said the following on 3/19/2007 5:03 PM:
>>Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:

Mel said the following on 3/19/2007 11:45 AM:
I have a page with a <DIVthat gets updated every 10 seconds. The
problem is that unless the browser is configured to get new pages at
all times, it displays the page from cache.
>
Is there a way to prevent this from happenning ?
Yes, use a unique URL by adding a timestamp to the URL.
if you can get to the headers, you can help it too... here is a snippet
of code from my PHP generating pages:

//IE actually caches ajax pages. Just another reason to hate that
browser.
Hate a browser because it doesn't act the way you want it to instead of
learning how to code it. Intuitive.

It's pretty easy to hate a browser that continually shifts its
"standards", I've seen many websites that render fine in IE6 that don't
render properly in IE7.
I guess you have never tried dynamically creating a table in IE/FF then?
IE gets it right, FF gets it dead wrong. The list is endless both ways.
The function of a browser is write once display anywhere...
No, the function of a browser is to display the resource given to it.
so this is clearly a failure on MS's part not in the programmers.
The same can also be said about FF, Mozilla, Opera, Safari and any other
browser you want to name. Doesn't mean you hate the browser, it means
you learn how to deal with it.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 19 '07 #6
On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:
Ivan Marsh said the following on 3/19/2007 6:11 PM:
>On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>>Good Man said the following on 3/19/2007 5:03 PM:
Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:

Mel said the following on 3/19/2007 11:45 AM:
>I have a page with a <DIVthat gets updated every 10 seconds. The
>problem is that unless the browser is configured to get new pages at
>all times, it displays the page from cache.
>>
>Is there a way to prevent this from happenning ?
Yes, use a unique URL by adding a timestamp to the URL.
if you can get to the headers, you can help it too... here is a snippet
of code from my PHP generating pages:

//IE actually caches ajax pages. Just another reason to hate that
browser.
Hate a browser because it doesn't act the way you want it to instead of
learning how to code it. Intuitive.

It's pretty easy to hate a browser that continually shifts its
"standards", I've seen many websites that render fine in IE6 that don't
render properly in IE7.

I guess you have never tried dynamically creating a table in IE/FF then?
IE gets it right, FF gets it dead wrong. The list is endless both ways.
>The function of a browser is write once display anywhere...

No, the function of a browser is to display the resource given to it.
>so this is clearly a failure on MS's part not in the programmers.

The same can also be said about FF, Mozilla, Opera, Safari and any other
browser you want to name. Doesn't mean you hate the browser, it means
you learn how to deal with it.
So you think it's perfectly okay for three versions of the same browser
from the same company to display the same information three different ways?

You're very forgiving.
Mar 19 '07 #7
Ivan Marsh said the following on 3/19/2007 6:26 PM:
On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:
>Ivan Marsh said the following on 3/19/2007 6:11 PM:
>>On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:

Good Man said the following on 3/19/2007 5:03 PM:
Randy Webb <Hi************@aol.comwrote in
news:hf********************@giganews.com:
>
>Mel said the following on 3/19/2007 11:45 AM:
>>I have a page with a <DIVthat gets updated every 10 seconds. The
>>problem is that unless the browser is configured to get new pages at
>>all times, it displays the page from cache.
>>>
>>Is there a way to prevent this from happenning ?
>Yes, use a unique URL by adding a timestamp to the URL.
if you can get to the headers, you can help it too... here is a snippet
of code from my PHP generating pages:
>
//IE actually caches ajax pages. Just another reason to hate that
browser.
Hate a browser because it doesn't act the way you want it to instead of
learning how to code it. Intuitive.
It's pretty easy to hate a browser that continually shifts its
"standards", I've seen many websites that render fine in IE6 that don't
render properly in IE7.
I guess you have never tried dynamically creating a table in IE/FF then?
IE gets it right, FF gets it dead wrong. The list is endless both ways.
>>The function of a browser is write once display anywhere...
No, the function of a browser is to display the resource given to it.
>>so this is clearly a failure on MS's part not in the programmers.
The same can also be said about FF, Mozilla, Opera, Safari and any other
browser you want to name. Doesn't mean you hate the browser, it means
you learn how to deal with it.

So you think it's perfectly okay for three versions of the same browser
from the same company to display the same information three different ways?
Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 19 '07 #8
On Mon, 19 Mar 2007 19:05:22 -0400, Randy Webb wrote:
Ivan Marsh said the following on 3/19/2007 6:26 PM:
>On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:
>>Ivan Marsh said the following on 3/19/2007 6:11 PM:
On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:

Good Man said the following on 3/19/2007 5:03 PM:
>Randy Webb <Hi************@aol.comwrote in
>news:hf********************@giganews.com:
>>
>>Mel said the following on 3/19/2007 11:45 AM:
>>>I have a page with a <DIVthat gets updated every 10 seconds.
>>>The problem is that unless the browser is configured to get new
>>>pages at all times, it displays the page from cache.
>>>>
>>>Is there a way to prevent this from happenning ?
>>Yes, use a unique URL by adding a timestamp to the URL.
>if you can get to the headers, you can help it too... here is a
>snippet of code from my PHP generating pages:
>>
>//IE actually caches ajax pages. Just another reason to hate that
>browser.
Hate a browser because it doesn't act the way you want it to instead
of learning how to code it. Intuitive.
It's pretty easy to hate a browser that continually shifts its
"standards", I've seen many websites that render fine in IE6 that
don't render properly in IE7.
I guess you have never tried dynamically creating a table in IE/FF
then? IE gets it right, FF gets it dead wrong. The list is endless
both ways.

The function of a browser is write once display anywhere...
No, the function of a browser is to display the resource given to it.

so this is clearly a failure on MS's part not in the programmers.
The same can also be said about FF, Mozilla, Opera, Safari and any
other browser you want to name. Doesn't mean you hate the browser, it
means you learn how to deal with it.

So you think it's perfectly okay for three versions of the same browser
from the same company to display the same information three different
ways?

Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?
I do remember one occasion where minor changes in the way Netscape
rendered caused issue with some web sites... in Netscape 6.0
Mar 20 '07 #9
Ivan Marsh said the following on 3/20/2007 10:45 AM:
On Mon, 19 Mar 2007 19:05:22 -0400, Randy Webb wrote:
>Ivan Marsh said the following on 3/19/2007 6:26 PM:
>>On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:

Ivan Marsh said the following on 3/19/2007 6:11 PM:
On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>
<snip>
>>>>so this is clearly a failure on MS's part not in the programmers.
The same can also be said about FF, Mozilla, Opera, Safari and any
other browser you want to name. Doesn't mean you hate the browser, it
means you learn how to deal with it.
So you think it's perfectly okay for three versions of the same browser
from the same company to display the same information three different
ways?
Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?

I do remember one occasion where minor changes in the way Netscape
rendered caused issue with some web sites... in Netscape 6.0
Did you "Hate Netscape" or write it off as a cost of progress?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 20 '07 #10
On Tue, 20 Mar 2007 12:18:48 -0400, Randy Webb wrote:
Ivan Marsh said the following on 3/20/2007 10:45 AM:
>On Mon, 19 Mar 2007 19:05:22 -0400, Randy Webb wrote:
>>Ivan Marsh said the following on 3/19/2007 6:26 PM:
On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:

Ivan Marsh said the following on 3/19/2007 6:11 PM:
>On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>>
>>
<snip>
>>>>>so this is clearly a failure on MS's part not in the programmers.
The same can also be said about FF, Mozilla, Opera, Safari and any
other browser you want to name. Doesn't mean you hate the browser,
it means you learn how to deal with it.
So you think it's perfectly okay for three versions of the same
browser from the same company to display the same information three
different ways?
Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?

I do remember one occasion where minor changes in the way Netscape
rendered caused issue with some web sites... in Netscape 6.0

Did you "Hate Netscape" or write it off as a cost of progress?
I can forgive a single incident, maybe even two... but I did stop using
Netscape shortly after that.

It's a bit surprising to find there's someone in the world defending
incompetence, lack of adherence to standards and chaos in general. You
must be a truly interesting person.
Mar 20 '07 #11
Ivan Marsh said the following on 3/20/2007 2:35 PM:
On Tue, 20 Mar 2007 12:18:48 -0400, Randy Webb wrote:
>Ivan Marsh said the following on 3/20/2007 10:45 AM:
>>On Mon, 19 Mar 2007 19:05:22 -0400, Randy Webb wrote:

Ivan Marsh said the following on 3/19/2007 6:26 PM:
On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:
>
>Ivan Marsh said the following on 3/19/2007 6:11 PM:
>>On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>>>
>>>
<snip>
>>>>>>so this is clearly a failure on MS's part not in the programmers.
>The same can also be said about FF, Mozilla, Opera, Safari and any
>other browser you want to name. Doesn't mean you hate the browser,
>it means you learn how to deal with it.
So you think it's perfectly okay for three versions of the same
browser from the same company to display the same information three
different ways?
Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?
I do remember one occasion where minor changes in the way Netscape
rendered caused issue with some web sites... in Netscape 6.0
Did you "Hate Netscape" or write it off as a cost of progress?

I can forgive a single incident, maybe even two... but I did stop using
Netscape shortly after that.
Then I would guess that you don't use IE?
It's a bit surprising to find there's someone in the world defending
incompetence, lack of adherence to standards and chaos in general.
I wasn't defending MS, I was questioning the reasoning behind "I hate
IE" as it seems that MS is just the target of it. Nothing more, nothing
less. If the accusations go across the board then it is fine. But when
people say "I hate IE" simply to seem "cool" (think M$ as well) it
seems, well, odd.
You must be a truly interesting person.
The people around me say that I am a one of a kind and most of them say
prayers to be thankful for it :)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 20 '07 #12
On Tue, 20 Mar 2007 19:49:35 -0400, Randy Webb wrote:
Ivan Marsh said the following on 3/20/2007 2:35 PM:
>On Tue, 20 Mar 2007 12:18:48 -0400, Randy Webb wrote:
>>Ivan Marsh said the following on 3/20/2007 10:45 AM:
On Mon, 19 Mar 2007 19:05:22 -0400, Randy Webb wrote:

Ivan Marsh said the following on 3/19/2007 6:26 PM:
>On Mon, 19 Mar 2007 18:24:17 -0400, Randy Webb wrote:
>>
>>Ivan Marsh said the following on 3/19/2007 6:11 PM:
>>>On Mon, 19 Mar 2007 17:54:30 -0400, Randy Webb wrote:
>>>>
>>>>
<snip>

>>>so this is clearly a failure on MS's part not in the programmers.
>>The same can also be said about FF, Mozilla, Opera, Safari and any
>>other browser you want to name. Doesn't mean you hate the browser,
>>it means you learn how to deal with it.
>So you think it's perfectly okay for three versions of the same
>browser from the same company to display the same information three
>different ways?
Just curious, but did you ask the same thing when NS7 came out with
regards to three different versions displaying the same information
three different ways? Or, is it just MS that makes it "different"?
I do remember one occasion where minor changes in the way Netscape
rendered caused issue with some web sites... in Netscape 6.0
Did you "Hate Netscape" or write it off as a cost of progress?

I can forgive a single incident, maybe even two... but I did stop using
Netscape shortly after that.

Then I would guess that you don't use IE?
>It's a bit surprising to find there's someone in the world defending
incompetence, lack of adherence to standards and chaos in general.

I wasn't defending MS, I was questioning the reasoning behind "I hate
IE" as it seems that MS is just the target of it. Nothing more, nothing
less. If the accusations go across the board then it is fine. But when
people say "I hate IE" simply to seem "cool" (think M$ as well) it
seems, well, odd.
There's an alleged group of people in the world that believe it makes them
seem cool to say "I hate IE"?

I can't decide which is more ridiculous... that being true or anyone
caring.

Mar 21 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Bugsy | last post by:
hi fellows pro,,,,, i want some details regarding AJAX. can anyone help me in that .... reply me with some good articles as well as tutorials in (.net)
1
by: one | last post by:
Hi, I just went into a debate with my colleague regarding these technologies. I think they are not the same: At a high-level... Client-side caching is to do with temporary internet file and...
5
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated),...
3
by: Purti Malhotra | last post by:
Hi All, In our Web hosting environment we are using Virtual hosting i.e. multiple websites are on one server and multiple domains are pointing to a single website. Issue: We have two domains...
1
by: JohnnieTech | last post by:
I am using some javascript/ajax to load content into a main div. The problem I am running into is that it will work in IE but not in FF. In FF I don't get any sort of load at all. I have a 1...
1
by: Yan | last post by:
Hi, I'm apparently far from being the 1st one to meet this error... My asp.net ajax page requires ScriptManager.axd but gets a 404. following a lot of "This is how I solved it" posts, I : -...
8
by: Tomasz J | last post by:
Hello developers, After migrating my web project application (using the old model) to .Net Framework 3.5 and Ajax Control Toolkit release 20820 the Accordion control no longer works correctly....
19
by: Conrad Lender | last post by:
| 5.40 Why is my Ajax page not updated properly when using an HTTP GET | request in Internet Explorer? | | Microsoft Internet Explorer caches the results of HTTP GET requests. | To ensure that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.