Is this a bug or am I just terribly stupid? ;-)
You can find my test code below
----------------------------
<html>
<head>
<title>test</title>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<script type="text/javascript" src="prototype.js"></script>
</head>
<body>
<div id="time"></div>
<script type="text/javascript">
Event.observe(window, 'load', doUpdate(), false);
function doUpdate() {
new Ajax.PeriodicalUpdater('time', 'time.php',
{
method: 'get',
frequency: 1
});
}
</script>
</body>
</html>
----------------------------
time.php just contains <?php echo date("H:i:s"); ?>
First, in your Event.observe call, remove the parenthesis from
doUpdate() so you pass the function itself rather than calling it.
Second, you don't actually need to use the load event since your JS
follows the "time" div. The div has been loaded into the DOM, so you
can go ahead and reference it. If you put your script in the header
(which I would), then you need the load event.
All that said, your code should still create the PeriodicalUpdater.
Make sure you're not getting a security warning in IE, and also try
retrieving a static text file.
Just to make sure I got you right Adam, this is the changed html file:
----------------------------
<html>
<head>
<title>test</title>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript">
Event.observe(window, 'load', doUpdate, false);
function doUpdate() {
new Ajax.PeriodicalUpdater('time', 'test.txt',
/*new Ajax.PeriodicalUpdater('time', 'time.php',*/
{
method: 'get',
frequency: 1
});
}
</script>
</head>
<body>
<div id="time"></div>
</body>
</html>
----------------------------
Have a look at this: http://en.wikipedia.org/wiki/XMLHTTP#Microsoft_Internet_Explorer_cache_issues
Please close the trac ticket you reopened if that solves your issue.
Thank you.
On 18 Jun., 22:07, tobie <tobie.lan...@gmail.com> wrote:
> Sound like you're not setting up correct headers on your server.
>
> Have a look at this:http://en.wikipedia.org/wiki/XMLHTTP#Microsoft_Internet_Explorer_cach...
I'm in the same fix. I read the wikipedia link above, but I didn't
understand how to relate that to code using Prototype. Could you
clarify what you have done to make your application work?
For reference, my code is:
<script type="text/javascript" language="javascript"
src="prototype.js"></script>
<script type="text/javascript" language="javascript">
obj = new Ajax.PeriodicalUpdater(
'sum_display',
'reader.php',
{
method: 'get',
parameters: {file : 'cache.html'},
frequency: 60
}
);
</script>
Where does the script described in the wikipedia page fit into that?
Thanks in advance for explanations
François