Hi,
I have a CMS website that does most page editing inside an iframe, using normal HTML forms and php. Once the page has been updated inside the iframe, I call a javascript function (I wrote) to refresh the parent frame.
The problem is that 50% of the time the refresh gets stuck in some weird loop, and keeps trying refresh... but only seems to refresh itself every second, not the parent page just once.
My code is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
<title>refreshing page...</title>
</head>
<div id="ajax_reload">
<p> </p>
<p><b>Refreshing page in 1 seconds... please wait or <a href="#Top" onMouseDown="reload()">click here</a></b></p>
</div>
<script type="text/JavaScript" language="JavaScript">
<!--
function reload() {
parent.frames.location.href = 'http://www.mywebsite.com/administrator/?id=22';
}
setInterval ("reload()", 1000);
//-->
</script>
</body>
</html>
Can anyone shed some light on the possible problem with the javascript part of this code, that may be causing it to loop incessantly?
Ps, remember its inside an iframe.
Thank you.