Reputation: 1
this post is related to window.onload() is not firing with IE 8 in first shot.
From within the main page (window) I open a new window:
... window.open('foobar.php',<...>); ...
The new window is opened correctly but the code within the window.onload() section (located in 'foobar.php') is not executed:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>foobar</title>
<script type="text/javascript">
//<![CDATA[
window.onload = function ()
{
alert('foobar');
}
//]]>
</script>
</head>
<body>
</body>
</html>
The replacement of "window.onload" by Prototype's "document.observe('dom:loaded', function()" and the "onload" attribute in the body-Tag do not work, too. If I reload the content of the new opened window or open it again then the code is working correctly. If I run the code from within the main window then the code is working correctly, too. It seems to be a caching problem but I'm not sure.
My IE version is 8.0.6001.18702. I have put off all Add-Ons.
Many thanks in advance
Upvotes: 0
Views: 2354
Reputation: 114377
Since the script is in the page that was ALREADY LOADED, the onload event happened long ago.
There is a difference between when the window has loaded and when the DOM is ready.
Upvotes: 1