Principles of Active Client Pages: the Script Approach - Principles of the Script Approach
(Page 4 of 4 )
With this approach, you design your document in such a way that it is rendered as it arrives at the browser. With this approach, you use a frameset. There is, however, only one frame in the frameset. Each time the user needs a new page, the content of the frame is changed. The new content is your new page.
The first page is downloaded with the frameset, as a string. This happens when the user types the address of the frameset document in his address bar of his browser and clicks Go. The author of the web site's development knows the next few pages that the user will request. When the first page is displayed, these pages are downloaded in advance in the background, without the user knowing.
The pages are downloaded as JavaScript code. These scripts could be internal or external. They are included at the bottom of the frame document, preferably, just above the end BODY tag. After a JavaScript file has been downloaded, the statements in the file are executed. The pages are in string form and are assigned as strings to variables or object properties or arrays in the JavaScript in the frameset.
However, the scripts should not be many, so that their total download time will not retard the user’s work. Each page (content of the frame) can have its own scripts (internal or external). Each of these scripts can be used to produce further pages. Before a page is produced, its downloaded content can be changed, by any of the scripts (in frameset or frame) as a result of user interaction.
Concerning scripting, script that does the data analysis should be put in the HTML HEAD element of the frameset or frame document. The scripts that are just string values representing pages should be put at the bottom of the document, preferably just before the end tag of the HTML BODY element. Note that a script that is just a string value representing a page can also have a head element as a sub-string in the string. This HEAD sub-string can also have a sub-string, which will become script for analysis.
Any page you see, including its HTML elements, has normally been a string content of some script.
With this approach, you count on the fact that information is displayed as it is rendered to the browser. In this way, scripts to be downloaded are at the bottom of the frame document. Any frame document can have the script tags at its bottom.
After a script has been downloaded, it is executed. While the scripts at the bottom are being downloaded and executed, the user can be using the page. Let the scripts to be downloaded not be many, so that the mouse pointer will quickly take its shape and the indicator showing that the page is loading should quickly complete its manifestation. So, as soon as the page that the user has to see is displayed, downloading of the scripts in the script tags at the bottom begins. Note that ACP not only solves the speed problem, it also solves other problems.
As I might have mentioned, the frameset has a script. As you are changing the content of the frame, you may need data from some previous contents to display the new frame content (remember, the frame content is the page you see). Your store is made up of the variables, arrays or object properties in the JavaScript of the frameset. The script in the frameset can have functions. It can always change values in the page of the frame. The script in the page of the frame can always retrieve values from the frameset or change values there.
As I said above, the downloaded script can always include programming (JavaScript) code. Calculations and analysis are done at the client by the overall JavaScript.
This set of principles is derived from Vlad’s works. You can read his original works from the following links:
http://www.fishwasher.com/acp/acp1.html
http://www.fishwasher.com/jst/page1.html
http://www.fishwasher.com
We take a break here and continue in the next part of the series.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |