S
Salvatore Sanfilippo
Hello all,
I've a very simple problem that appears to don't have a simple
solution.
I've a (dynamically generated) page with a number of external links.
What I need is that if the user clicks on an external link, before
to reach the link, the current page gets reloaded.
My first try was the obvious:
window.location.reload();
window.location='...';
This works in Firefox but does not on IE.
My second try what something like:
window.onload=function() {window.location='...';};
window.location.reload();
but this does not work in Firefox nor IE, other browsers not tested.
How can I fix this?
It is just as fine if there is a way to reload the page after the user
press the BACK button of the browser.
But I want to spend some word about why I've this problem, maybe
I'm doing something wrong.
Well that's simple, if I change stuff in the page using Ajax, when
the user follow a link, and then go back with the BACK button of
the browser the page does not "remember" that it was updated
via Ajax.
Thank you very much for any help,
p.s. what still I didn't tried is to put the reload as body.onLoad
event
and use cookies to set a flag so that at the first load it will not be
reloaded (forever... in a loop), but when I leave the page I set
the cookie before to leave, then when I'm back the reload will happen,
deleting the cookie just before to reload. Is this an idiomatic
solution?
I may like more one without a cookie if possible.
Regards,
Salvatore
I've a very simple problem that appears to don't have a simple
solution.
I've a (dynamically generated) page with a number of external links.
What I need is that if the user clicks on an external link, before
to reach the link, the current page gets reloaded.
My first try was the obvious:
window.location.reload();
window.location='...';
This works in Firefox but does not on IE.
My second try what something like:
window.onload=function() {window.location='...';};
window.location.reload();
but this does not work in Firefox nor IE, other browsers not tested.
How can I fix this?
It is just as fine if there is a way to reload the page after the user
press the BACK button of the browser.
But I want to spend some word about why I've this problem, maybe
I'm doing something wrong.
Well that's simple, if I change stuff in the page using Ajax, when
the user follow a link, and then go back with the BACK button of
the browser the page does not "remember" that it was updated
via Ajax.
Thank you very much for any help,
p.s. what still I didn't tried is to put the reload as body.onLoad
event
and use cookies to set a flag so that at the first load it will not be
reloaded (forever... in a loop), but when I leave the page I set
the cookie before to leave, then when I'm back the reload will happen,
deleting the cookie just before to reload. Is this an idiomatic
solution?
I may like more one without a cookie if possible.
Regards,
Salvatore