It can be useful, in certain particular cases, to get the mainPage
and thisDFrame values before dFrameAPI starts the onLoadDFrame() function:
For instance the following code, in a page inserted in a
DFrame shows a global variable of mainPage:
<HTML>
<BODY>
<script>
document.write(mainPage.value)
</script>
</BODY>
The problem is that, for
Internet Explorer and Netscape 6, the mainPage and thisDFrame variables are not
yet initialized in the Javascript environment of the page containing the code
at the time they are needed. The preceding code will thus function correctly
with Netscape 4 but you will have to include the following 'patch' for IE and
NS6:
if (navigator.appName == "Microsoft Internet Explorer" ||_
(navigator.appName == "Netscape" && parseInt(navigator.appName) == 5))_
window.parent.getDFrameValues()
Happily there is a shortest way: It is to test if there is a parent window and if the
getDFrameValues function exists in the parent window'. And, as for IE
window.parent is set to self if none, this value is also tested:
if (window.parent && window.parent != self && window.parent.getDFrameValues) window.parent.getDFrameValues()
Example :
file:
getDFrameValues.html