Java Reference
In-Depth Information
</td><td valign="top">Heaton Research, Inc.<br>
HTTP Recipes Test Site
</td></tr>
</table>
<hr><p><small>[<a href="/">Home</a>:<a href="/1/">
First Edition</a>:<a href="/1/9/">Chaper 9</a>]</small></p>
<h1>JavaScript Includes</h1>
This text is not in the JavaScript include file and could be load-
ed normally by<br>
a bot. However, the text in the next block is contained in a
JavaScript<br>
include file.<br>
<hr>
<script type="text/javascript" src="include.js"></script>
<hr>
<p>Copyright 2006 by
<a href="http://www.heatonresearch.com/">Heaton Research, Inc.
</a></p>
</BODY>
</HTML>
The JavaScript include statement includes another file, named include.js . You can
see this include statement here:
<script type="text/javascript" src="include.js"></script>
This will cause the file include.js to be included as part of the HTML file. How-
ever, the include.js file is assumed to be JavaScript, so no <script> tags are neces-
sary inside include.js . The include.js source is shown below:
document.write('This text is coming from a JavaScript include
file<br>');
document.write('It is not contained in the main HTML file, and
must<br>');
document.write('be loaded in a different HTTP GET request.<br>');
As a separate request, the web browser will load the include.js file. It is a regular
web document, which can be found at the following address:
http://www.httprecipes.com/1/9/include.js
To process JavaScript includes with a bot, you must examine what they contain and how
you will obtain what you need from them. Like the other JavaScript techniques, it is a matter
of providing the correct HTTP requests to the server and processing the responses. Recipe
9.2 shows how to process this URL.
Search WWH ::




Custom Search