Adding grunt command line globally
[mootools.git] / Docs / Browser / Browser.md
blobf7874ed0e90e8b39fc1db4a703c77e9e5cdd9f83
1 Object: Browser {#Browser}
2 ==========================
4 Some browser properties are attached to the Browser Object for browser and platform detection.
6 Browser.Features {#Browser:Browser-Features}
7 --------------------------------------------
9 * Browser.Features.xpath - (*boolean*) True if the browser supports DOM queries using XPath.
10 * Browser.Features.air - (*boolean*)  True if the browser supports AIR.
11 * Browser.Features.query - (*boolean*) True if the browser supports querySelectorAll.
12 * Browser.Features.json - (*boolean*) True if the browser has a native JSON object.
13 * Browser.Features.xhr - (*boolean*) True if the browser supports native XMLHTTP object.
15 Browser.name {#Browser:Browser-name}
16 ------------------------------------
18 'Browser.name' reports the name of the Browser as string, identical to the property names of the following Boolean values:
20 * Browser.ie - (*boolean*) True if the current browser is Internet Explorer.
21 * Browser.firefox - (*boolean*) True if the current browser is Firefox.
22 * Browser.safari - (*boolean*) True if the current browser is Safari.
23 * Browser.chrome - (*boolean*) True if the current browser is Chrome.
24 * Browser.opera - (*boolean*) True if the current browser is Opera.
26 In addition to one of the above properties a second property consisting of the name and the major version is provided ('Browser.ie6', 'Browser.chrome15', ...).
28 If 'Browser.chrome' is True, all other possible properties, like 'Browser.firefox', 'Browser.ie', ... , will be `undefined`.
30 ### Example:
32         alert(Browser.name); // Alerts "ie" in Internet Explorer, "firefox" in Mozilla Firefox, "chrome" in Google Chrome, "safari" or "opera".
34         if (Browser.ie){
35                 // This code will only run in IE
36         }
38         if (Browser.firefox2){
39                 // This code will only run in Firefox 2
40         }
42         if (Browser.ie6 || Browser.ie7){
43                 // Please upgrade your browser
44         }
46 If an IE document is set to backwards compatibility mode using the X-UA-Compatible header, then the Browser object is treated as if the earlier version of the browser is running.
48 Browser.version {#Browser:Browser-version}
49 ------------------------------------------
51 'Browser.version' reports the version of the Browser as number.
53 ### Example:
55         alert(Browser.version); // Alerts '3.6' in FireFox 3.6.13
57 Browser.Platform {#Browser:Browser-Platform}
58 --------------------------------------------
60 * Browser.Platform.mac - (*boolean*) True if the platform is Mac.
61 * Browser.Platform.win - (*boolean*) True if the platform is Windows.
62 * Browser.Platform.linux - (*boolean*) True if the platform is Linux.
63 * Browser.Platform.ios - (*boolean*) True if the platform is iOS.
64 * Browser.Platform.android - (*boolean*) True if the platform is Android
65 * Browser.Platform.webos - (*boolean*) True if the platform is WebOS
66 * Browser.Platform.other - (*boolean*) True if the platform is neither Mac, Windows, Linux, Android, WebOS nor iOS.
67 * Browser.Platform.name - (*string*) The name of the platform.
69 Browser.Plugins {#Browser:Browser-Plugins}
70 ------------------------------------------
72 * Browser.Plugins.Flash - (*object*) - An object with properties corresponding to the `version` and `build` number of the installed Flash plugin. Note: if flash is not installed, both `Browser.Plugins.Flash.version` and `Browser.Plugins.Flash.build` will return zero.
73 * Browser.Plugins.Flash.version - (*number*) The major version of the flash plugin installed.
74 * Browser.Plugins.Flash.build - (*number*) The build version of the flash plugin installed.
76 Browser.Request {#Browser:Browser-Request}
77 ------------------------------------------
79 * Browser.Request - (*object*) The XMLHTTP object or equivalent.
81 Browser.exec {#Browser:Browser-exec}
82 ------------------------------------
84 Executes the passed in string in the browser context.
86 ### Example:
88         Browser.exec('alert("Moo!");');
90 Deprecated {#Deprecated}
91 ------------------------
93 The *Browser.Engine* object is deprecated since MooTools 1.3.
95 ### Engine:
97 * Browser.Engine.trident - (*boolean*) True if the current browser uses the trident engine (e.g. Internet Explorer).
98 * Browser.Engine.gecko - (*boolean*) True if the current browser uses the gecko engine (e.g. Firefox, or any Mozilla Browser).
99 * Browser.Engine.webkit - (*boolean*) True if the current browser uses the webkit engine (e.g. Safari, Google Chrome, Konqueror).
100 * Browser.Engine.presto - (*boolean*) True if the current browser uses the presto engine (e.g. Opera 9).
101 * Browser.Engine.name - (*string*) The name of the engine.
102 * Browser.Engine.version - (*number*) The version of the engine. (e.g. 950)