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

Browser: Getting information about the client


There are plenty of reasons why you would want to gain insight about the people viewing your web pages. For example, if you'd like to determine what the most popular web browser accessing your website/web application is, or what operating system people use, then you can use MooTools in conjunction with a server-side scripting language (like PHP), and a database (like MySQL), to mine this information.

The Browser component can do three things:

  1. Determine whether a browser has a specific feature (Browser.Features)

  2. What rendering engine (Browser.Engine) it uses

  3. What operating system (Browser.Platform) the client is running on

Determining if the client has a specific feature

MooTools can help you find out whether or not XPath (a querying language for XML documents) or the XMLHTTP object (used for Ajax) are available in the client browser by using Browser.Features.

Browser.Features.xpath

Browser.Features.xpath returns a Boolean value (true or false).

By...