M
Mirko
Hi all,
I have a problem in some code using a Javascript Timer.
Her is the matter :
In my page, when user enters, an automatic 'onload' post is generated,
the resulting page contains an image with some info (an ad) displayed
on the page.
I need to display this code 'before' another automatic post is sent to
the server to perform the "real access", so I used a 'trick' to be
sure that image is displayed completely before sending the second post
(please note, I need a 'post' not a simple redirect....)
function imageloaded() {
timerID = window.setTimeout("NowGetAccess()", 1500); // additional
1,5-second interval for image display !
// alert("loaded image, start waiting");
}
function NowGetAccess() {
window.clearTimeout(timerID);
ExecutePost("myaccesspage.php"); // this actually performs a post
to the page
}
This code works very fine, but 'occasionaly' it fails the second post
(it happens 1 time on almost 50 accesses from the same pc/browser,
apparently without any cause), leaving the browser freezed at the 'ad
page'.
It seems that sometimes the timer doesn't simply trigger the function.
I thought it to be a problem within user's browser, but I found that
it happens on IE 6.0 or IE 5.5 and on any platform....
Anyone knows why window.setTimeout occasionally fails if used like
this ??
Any help appreciated
Mirko
I have a problem in some code using a Javascript Timer.
Her is the matter :
In my page, when user enters, an automatic 'onload' post is generated,
the resulting page contains an image with some info (an ad) displayed
on the page.
I need to display this code 'before' another automatic post is sent to
the server to perform the "real access", so I used a 'trick' to be
sure that image is displayed completely before sending the second post
(please note, I need a 'post' not a simple redirect....)
function imageloaded() {
timerID = window.setTimeout("NowGetAccess()", 1500); // additional
1,5-second interval for image display !
// alert("loaded image, start waiting");
}
function NowGetAccess() {
window.clearTimeout(timerID);
ExecutePost("myaccesspage.php"); // this actually performs a post
to the page
}
This code works very fine, but 'occasionaly' it fails the second post
(it happens 1 time on almost 50 accesses from the same pc/browser,
apparently without any cause), leaving the browser freezed at the 'ad
page'.
It seems that sometimes the timer doesn't simply trigger the function.
I thought it to be a problem within user's browser, but I found that
it happens on IE 6.0 or IE 5.5 and on any platform....
Anyone knows why window.setTimeout occasionally fails if used like
this ??
Any help appreciated
Mirko