Home arrow JavaScript arrow Active Client Pages: More Questions and Answers on Chrys`s Approach
JAVASCRIPT

Active Client Pages: More Questions and Answers on Chrys`s Approach


This is the third part of my series, "Active Client Pages: Chrys’s Approach." We continue to learn the roots that give rise to my approach to Active Client Pages. We will also answer more questions about the technique and its capabilities.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 3
July 17, 2009
TABLE OF CONTENTS:
  1. · Active Client Pages: More Questions and Answers on Chrys`s Approach
  2. · Can any document use Ajax?
  3. · Can you create your own Back and Forward buttons?
  4. · The DOM go() Method

print this article
SEARCH DEVARTICLES

Active Client Pages: More Questions and Answers on Chrys`s Approach
(Page 1 of 4 )

Can you access the HTML contents of the loading document?

Assume that you have a document and it loaded another document. Which one is now the current document? You are now at the current document. The question is, can you access the HTML contents of the document that loaded the current document? The answer is no. The DOM specification does not give us any clear method for doing this.

Can you access the variables and functions of the loading document?

No. The DOM specification does not give us a clear method for doing this.

Can any document download a JavaScript?

Yes. The master document (page), or any loading document or loaded document, can have an external JavaScript tag that would load JavaScript. The loaded script content can be used to produce a new page (document). In the following example, when you click a button in the master page, the master page will produce a new page. The new page has an external JavaScript tag, which will automatically download a JavaScript. This second page has a button. When you click the button, the script loaded will produce a new page. There are three pages altogether. Each page is a document. This is the code for the master page:

 

<html>

<head>

<script type="text/JavaScript">

 

page2 = "<html>"

+ "<head>"

+ "</head>"

+ "<body>"

+ "This is the Second page.<br />"

+ "<button type="button" id="B1" onclick="show3()">Load Document 3</button>"

+ "<script src="forPage3.js"></script>"

+ "</body>"

+ "</html>";

 

function show2()

{

var pageTwo = document.open();

pageTwo.write(page2);

pageTwo.close();

}

</script>

</head>

<body>

This is the first page.<br />

<button type="button" id="B1" onclick="show2()">Load Document 2</button>

</body>

</html>

 

The BODY element of the master page has the sentence “This is the first page.” It also has a line break element and a button. The onclick event calls the function show2(), which loads the second document (page2). We have seen this type of function before. The argument of the write() method is page2.

This argument (page2) is a variable in the master page having the content of the second document. This content is in a string. All of the entities in the string are escaped. Part of this content is:

 

<script src="forPage3.js"></script>"

 

You can identify it in the value of the string variable, page2, where the entities are escaped. You should design the second page so that the browser renders it as it arrives (at the browser). This external JavaScript tag should be at the bottom of the page, so that as the page is loaded, while the user is seeing the content of the page, the downloading of the JavaScript will be taking place.

The script should not be too long, so that the indicators showing the downloading process should quickly stop their manifestation. The good news is that while the downloading is taking place, the user would still be reading through the second page. For our example here, the script is very short. This is the forPage3.js script content:

 

function show3 ()

{

var pageThree = document.open();

pageThree.write("This is the third page.");

pageThree.close();

}

 

The script has a function. When you click the button on the second page, this function will be called, and it will load the third page.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

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-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials