Home arrow HTML arrow Testing Browser Response to Active Client Pages
HTML

Testing Browser Response to Active Client Pages


Welcome to the fourth part of a five-part series that shows how browsers respond to Active Client Pages. In this part, we complete the code for the simple example to be used to test the response of browsers to Active Client Pages, and then we look at the features in the example that we shall use to assess the browsers.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
September 22, 2009
TABLE OF CONTENTS:
  1. · Testing Browser Response to Active Client Pages
  2. · Level 4
  3. · Features in the Example We Use in the Assessment of Browsers
  4. · Description of the Pages

print this article
SEARCH DEVARTICLES

Testing Browser Response to Active Client Pages
(Page 1 of 4 )

Features of the ACP example used to access Browsers

Doc1

Doc1 is loaded by Doc0 when you click the button in Doc0. Doc1 content resides in a file called sendPge3Doc1Str.pl at the server. This is the file:

$returnStr = qq{

<html>

<head>

<script type="text/javascript">

var var3_2 = "I am 3_2";


function showValueIn2_2()

{

alert(window.opener.storeVar2_2);

}

function openWin4()

{

win4 = window.open("","page4win","width=400,height=400");

win4.document.write(page4Win);

}

</script>

</head>

<body>

This is page 3 (win)<br />

<button type="button" onclick="showValueIn2_2()">Show the Value in Page 2_2</button>

<button type="button" onclick="openWin4()">Open a Page 4</button>


<script type="text/javascript">

//content of page 3 Doc1

var page4win = "";

 

//Ajax code to download next window

</script>

</body>

</html>

};


print $returnStr;

This is a Perl file with two Perl statements like the others. The quote operator has an HTML document. The HEAD element has a JavaScript that has two functions. The names of these functions are showValueIn2_2() and openWin4().

There are two functions in the BODY element. When you click one of the buttons, the showValueIn2_2() function will be called. This function displays the value of the JavaScript variable named storeVar2_2 in the window at level 2 (on the right in fig 3.1). This window is the opener (parent) to the window having Doc0 and Doc1. So the opener (parent window for Doc1) is this window (at level 2).

Let us look at what is inside the showValueIn2_2() function. You have just one statement inside the function; it is an alert statement. The following expression is the argument of the alert call:

window.opener.storeVar2_2

In this expression, window represents the present window (which has the two documents). Opener is a reference to the window that opened the present window. StoreVar2_2 is a JavaScript variable in the opener window. When the showValueIn2_2() function is called, the value of the storeVar2_2 variable is displayed.

This sounds good; however, for ACP programming today, I do not advice you to make calls from the document phase into the window phase and vice-versa. I will explain why in the next part of the series.

The openWin4() function opens a window. This window is at the fourth level in the tree in fig 3.1. The statements inside the function are normal statements for producing a window. The statements for producing a window are the same independent of whether you are producing the window from another window or a document. Likewise, the statements for producing a document are the same independent of whether you are producing the document from another document or a window. However, the statements for producing a document are not exactly the same as those for producing a window.

Let us look at what is in the BODY element. You have some text, a line break element, two buttons and a JavaScript. Each of these buttons has a corresponding function in the HEAD element.

Let us look at what is in the JavaScript. The first statement is the declaration of the page4win variable, which will hold the content of the next window in string form. Then you have the Ajax code which downloads the content of the next window. After downloading the content, it is assigned to the page4win variable. The value of this variable will be used by the openWin4() function only when you want to open the next window.


blog comments powered by Disqus
HTML ARTICLES

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials