Active Client Pages: Completing the Code for a Browser Example
The aim of this five-part series is to show to what extent a major browser responds to ACP. ACP is a new technology. In order to understand how a browser responds, we need an example to use to test the browser. We need to understand the example first. In this third part of the series I complete the explanation of the example.
Active Client Pages: Completing the Code for a Browser Example - Level 3 (Page 3 of 4 )
Look at level three in fig. 3.1. There is one window and two documents. The opener (parent) of the window is different from the opener (parent) of the documents. The documents are in one window (which has not been indicated in the diagram) and this window’s opener is different from that of the indicated window at level 3.
The window on the left at Level 3
Here we talk about the window indicated on the left of level 3 in fig 3.1. The name of the file for this window is sendWinPge3Str.pl. This is the content of the file:
$returnStr = qq{
<html>
<head>
<script type="text/javascript">
function precedeOrReturn(name)
{
if (window.name == name)
{
return window.self;
}
else
{
parentWin = window.opener;
return parentWin.precedeOrReturn(name);
}
}
function showValueInMaster()
{
theRef = precedeOrReturn("master");
alert(theRef.storeVarMaster);
}
</script>
</head>
<body>
This is page 3 win<br />
<button type="button" onclick="showValueInMaster()">Show the Value in Master Page</button>
</body>
</html>
};
print $returnStr;
It is a Perl file similar to the others. The HEAD element has a JavaScript, which has two functions. The first function is the Backward Propagation Code. I have explained how this function operates. The second one is called showValueInMaster(). There is a button in the BODY element of this page. When that button is clicked, this function is called. The aim of the function is to display the value of the storeVarMaster variable from the master page.
There are two statements in the showValueInMaster(). The first one calls the Backward Propagation Code, precedeOrReturn(), passing the name of the first page as argument. The name of the first page is “master.” This call returns a reference to the master page. That reference is used to display the value of the variable from the master page.
Let us look at what is in the BODY element. You have some text, a line break element and a button. When this button is clicked, the showValueInMaster() function is called to display the value of the variable from the master page. This window does not produce any other window, so it does not have the Ajax code. That is it for the left window at level 3.