Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Setting and getting HTTP headers


HTTP headers are meta information about an HTTP response; they define a lot of information about the data that you are sending and receiving. For example, with the Cache-Control HTTP response header, you can determine whether your data will be cached on the user's browser, and the Date HTTP request header gets a timestamp of the request.

This information is contained in the documents that you request, but is not shown explicitly in the HTML document's source code. But you can easily attain and set HTTP request and response headers by using JavaScript.

Note

For a full list of HTTP headers, please view the Wikipedia page entitled List of HTTP headers via the following HTTP address: http://en.wikipedia.org/wiki/List_of_HTTP_headers.

Setting an HTTP header for an Ajax Request object

When you create a MooTools Request object, you can choose to set HTTP headers for it using the setHeader() method in the Request class. For example, let's say you created a Request...